/* Customization code for component BAPMatching */
/*$ Reversion 1.1  Update by Bob Bao  ECO*BBX20150806*   Upgrate cusotmization from 2011.EE to 2014EE      */
&scoped-define class-version 107.1
/*BBX20150806 { definition/bapmatching.i } */
/*BBX20150806*/ 
/*eb2 SRR - SRR0475 EE SRR for Upgrade - EE1051-F*/
/* ************************************************************************ */  
/* Modified BY : Sachin SG01#SCTASK0096962_PCA155236       DT:29Oct2018     */
/* ************************************************************************ */ 

/*BBX20150806 ----- Upgrade Start -------  */
/*JJ*/
/*BBX20150806   Start Upgrade coding -------------------*/
/*JJ*/
{definition/bapmatching.i &USEDDATAITEMS="vcUserLogin,vcGlobalSessionId,vcActivityCode,viCompanyLCId,vcCompanyCode" } 
{us/bbi/mfdeclre.i "new"}
{us/bbi/mf1.i "new"}
{us/pp/ppprlst.i}


define variable lccurrent  as character   no-undo.
define variable lcReprice  as character   no-undo.
define variable lcPostdate as character   no-undo.
define variable v_debug    as log         no-undo. 


define temp-table tt_data no-undo
field tt_rec as character.

define new global shared variable v_tempuipai as character no-undo initial "API".


global_user_lang_dir = "us/".
global_user_groups = "qadadmin".

/****
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLine.before.
 define buffer b_sAPMatchingLn for t_sAPMatchingLn.
 define buffer b_oAPMatchingLn for t_oAPMatchingLn.
  output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLine.before.log.
  for each b_sAPMatchingLn.
  put unformatted time "  "string(b_sAPMatchingLn.PvoPostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarRatePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                                b_sAPMatchingLn.APMatchingLnPvodIntRef + "," +
                                string(b_sAPMatchingLn.APMatchingLnPvodOrderLnNbr) skip.
                                end.
  for each b_oAPMatchingLn.
  put unformatted time "  "string(b_oAPMatchingLn.PvoPostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarRatePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                         b_oAPMatchingLn.APMatchingLnPvodIntRef + "," +
                  string(b_oAPMatchingLn.APMatchingLnPvodOrderLnNbr) + "," + "b_oAPMatchingLn" skip.
                  end.                              
  output close.

end procedure.

PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLine.after.
 define buffer b_sAPMatchingLn for t_sAPMatchingLn.
 define buffer b_oAPMatchingLn for t_oAPMatchingLn.
 
   define variable lvc_apmathingid as character no-undo.
   define variable lvi_return as integer no-undo.
   define variable vcUserLogin1 as character no-undo.
   define variable vcUserName1 as character no-undo.
   define variable lvi_msg_nbr   as  integer    no-undo. 
   define variable vcMfgDomain1  as  character  no-undo.
   define variable viReturn      as  INTEGER    NO-UNDO.
   define variable lvi_recnt      as  INTEGER    NO-UNDO.
   define variable lvc_activity  as   character   no-undo.
   define variable lvc_origref   as   character   no-undo.
   define variable lvi_session_id as integer   no-undo.
   define variable lvc_session_id as character no-undo.
   define variable lvh_session    as handle    no-undo.
   define variable lvc_value      as character extent 10 no-undo.
   
  output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLine.after.log.
  
  lvi_recnt = 0.
   run getpublicdata(input "vcUserLogin", output vcUserLogin1 , output vireturn).
    run getpublicdata(input "vcUserName", output vcUserName1 , output vireturn).
    run getpublicdata(input "vcMfgDomain", output vcMfgDomain1 , output vireturn).
  
  
       run GetPublicData (input  "viSessionId",
                        output lvc_session_id,
                        output lvi_return).
    assign lvi_session_id = integer(lvc_session_id).

      run ins/ins__session.p persistent set lvh_session.

      run MainBlock in lvh_session
        (input 0,
         input 0,
         input 0,
         input no,
         input "",
         input-output lvi_session_id,
         output lvi_return).   


    if valid-handle(lvh_session)
    then do:
    
    do lvi_recnt = 1 to 10:
    lvc_value[lvi_recnt] = "".
  
 
     run SetCharacterValue in lvh_session
            (input "xx_lvc_apmathingid" + string(lvi_recnt)  ,
             input lvc_value[lvi_recnt],
             output lvi_return).		
    
     end.
    
    for each b_oAPMatchingLn :
      
      find pod_det where pod_nbr = b_oAPMatchingLn.APMatchingLnPvodOrder
               and pod_domain = vcMfgDomain1
               and pod_line = b_oAPMatchingLn.APMatchingLnPvodOrderLnNbr
               no-lock no-error.
     if available pod_det and pod__chr10 <> "" then
     do:
         
         lvi_recnt = lvi_recnt + 1 .
         lvc_value[lvi_recnt] = string(b_oAPMatchingLn.PvoPostingLine_ID) + "," + 
                                string(b_oAPMatchingLn.VarRatePostingLine_ID) + "," + 
                                string(b_oAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                                string(b_oAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                                b_oAPMatchingLn.APMatchingLnPvodIntRef + "," +
                                string(b_oAPMatchingLn.APMatchingLnPvodOrderLnNbr) + "," +
                                pod_det.pod__chr10.
                         
         run SetCharacterValue in lvh_session
            (input "xx_lvc_apmathingid" + string(lvi_recnt)  ,
             input lvc_value[lvi_recnt],
             output lvi_return).		
             
             put unformatted lvi_session_id "  xx_lvc_apmathingid" + string(lvi_recnt)  "," lvc_value[lvi_recnt] "," lvi_return skip.       
             
       end.      
     end.  /*  for each b_oAPMatchingLn : */    
             

    run StopInstance in lvh_session
         (input  "SAVE",
          input  "",
          input  "",
          input  no,
          output lvi_return).

         delete procedure lvh_session.
     end. /* if valid-handle(lvh_session) */

  
  
  
  
  for each b_sAPMatchingLn.
  put unformatted time "  "string(b_sAPMatchingLn.PvoPostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarRatePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                                b_sAPMatchingLn.APMatchingLnPvodIntRef + "," +
                                string(b_sAPMatchingLn.APMatchingLnPvodOrderLnNbr) skip.
                                end.
  for each b_oAPMatchingLn.
  
  
  put unformatted time "  "string(b_oAPMatchingLn.PvoPostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarRatePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                         b_oAPMatchingLn.APMatchingLnPvodIntRef + "," +
                  string(b_oAPMatchingLn.APMatchingLnPvodOrderLnNbr) + "," + "b_oAPMatchingLn" skip.
                  
                  
                  
                  
                  
                  
                  
                  end.                              
  output close.

end procedure.

PROCEDURE BAPMatching.AdditionalUpdatesAll.after:
 define buffer b_sAPMatchingLn for t_sAPMatchingLn.
 define buffer b_oAPMatchingLn for t_oAPMatchingLn.
  output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.AdditionalUpdatesAll.after.log.
  for each b_sAPMatchingLn.
  put unformatted string(b_sAPMatchingLn.PvoPostingLine_ID) + "," + 
                  string(b_sAPMatchingLn.VarRatePostingLine_ID) + "," + 
                  string(b_sAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                  string(b_sAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                         b_sAPMatchingLn.APMatchingLnPvodIntRef + "," +
                  string(b_sAPMatchingLn.APMatchingLnPvodOrderLnNbr) skip.
                 
   end.
   /*
     for each b_oAPMatchingLn.
  put unformatted string(b_oAPMatchingLn.PvoPostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarRatePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                         b_oAPMatchingLn.APMatchingLnPvodIntRef + "," +
                  string(b_oAPMatchingLn.APMatchingLnPvodOrderLnNbr) skip.
                  
   end.
   */
  output close.

end procedure.
 PROCEDURE BAPMatching.PreSave.before:
 define buffer b_sAPMatchingLn for t_sAPMatchingLn.
 define buffer b_oAPMatchingLn for t_oAPMatchingLn.
  output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.PreSave.before.log.
  for each b_sAPMatchingLn.
  put unformatted time "  "string(b_sAPMatchingLn.PvoPostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarRatePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                                b_sAPMatchingLn.APMatchingLnPvodIntRef + "," +
                                string(b_sAPMatchingLn.APMatchingLnPvodOrderLnNbr) skip.
                                end.
  for each b_oAPMatchingLn.
  put unformatted time "  "string(b_oAPMatchingLn.PvoPostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarRatePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                         b_oAPMatchingLn.APMatchingLnPvodIntRef + "," +
                  string(b_oAPMatchingLn.APMatchingLnPvodOrderLnNbr) + "," + "b_oAPMatchingLn" skip.
                  end.                              
  output close.
end procedure.

PROCEDURE BAPMatching.PreSave.after:
 define buffer b_sAPMatchingLn for t_sAPMatchingLn.
 define buffer b_oAPMatchingLn for t_oAPMatchingLn.
  output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.PreSave.after.log.
  for each b_sAPMatchingLn.
  put unformatted time "  "string(b_sAPMatchingLn.PvoPostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarRatePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                                b_sAPMatchingLn.APMatchingLnPvodIntRef + "," +
                                string(b_sAPMatchingLn.APMatchingLnPvodOrderLnNbr) skip.
                                end.
  for each b_oAPMatchingLn.
  put unformatted time "  "string(b_oAPMatchingLn.PvoPostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarRatePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                  string(b_oAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                         b_oAPMatchingLn.APMatchingLnPvodIntRef + "," +
                  string(b_oAPMatchingLn.APMatchingLnPvodOrderLnNbr) + "," + "b_oAPMatchingLn" skip.
                  end.                              
  output close.
end procedure.


***/
PROCEDURE BAPMatching.DataSave.after:

 output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.DataSave.after.log.
   for each t_oAPMatchingLn.
   export t_oAPMatchingLn.
   for each APMatchingLn where APMatchingLn.APMatchingLn_id = t_oAPMatchingLn.APMatchingLn_id no-lock.
    put "APMatchingLn" skip.
    export APMatchingLn.
    
    end.   
   end.

   output close.

END PROCEDURE.
PROCEDURE BAPMatching.PostSave.after:
   define buffer b_Postingline for Postingline.
   define buffer b_Posting for Posting.
    define variable vcMfgDomain1  as  character  no-undo.
    define variable vcUserName1  as  character  no-undo.
    define variable vcUserLogin1  as  character  no-undo.
   define variable viReturn      as  INTEGER    NO-UNDO.
   define variable lvi_msg_nbr as integer   no-undo.    
   define variable lvc_msg_txt as character no-undo.  
   define variable errorst     as   character   no-undo.
   define variable errornum    as   integer     no-undo.
   define variable vc_cipnbr     as  character no-undo.
   define variable l_msg1      like msg_desc    no-undo.
   define variable vc_daybook   as character    no-undo.
   define variable lvc_value      as character extent 10 no-undo.
   define variable lvi_recnt      as  INTEGER    NO-UNDO.
   define buffer b_toAPMatchingLn for t_oAPMatchingLn.
   define variable lvi_return as integer   no-undo.
   define variable lvi_session_id as integer   no-undo.
   define variable lvc_session_id as character no-undo.
   define variable vcActivityCode  as character no-undo.
   define variable lvh_session    as handle    no-undo.
   define variable lvh_session1    as handle    no-undo.
   
 output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.PostSave.after.log.
 
    run getpublicdata(input "vcUserLogin", output vcUserLogin1 , output vireturn).
    run getpublicdata(input "vcUserName", output vcUserName1 , output vireturn).
    run getpublicdata(input "vcMfgDomain", output vcMfgDomain1 , output vireturn).
   for each b_toAPMatchingLn,
        each b_PostingLine where b_PostingLine.PostingLine_id = b_toAPMatchingLn.PvoPostingLine_ID
                              or b_PostingLine.PostingLine_id = b_toAPMatchingLn.VarRatePostingLine_ID
                              or b_PostingLine.PostingLine_id = b_toAPMatchingLn.VarUsagePostingLine_ID
                              or b_PostingLine.PostingLine_id = b_toAPMatchingLn.NewExpensePostingLine_ID,
         each b_Posting .
   export  b_PostingLine.
   
	find GL where GL.GL_id = b_PostingLine.gl_id no-lock no-error.
   find costcentre of b_PostingLine no-lock no-error.
   find division of b_PostingLine no-lock no-error.
   find project of b_PostingLine no-lock no-error.
   find journal where journal.journal_id = b_Posting.Journal_id  no-lock no-error.
   
   
    /*  价差可能不是在建工程账户 要先找控制文件 ，如果不是产生调整的凭证 */
       if can-find(first code_mstr where code_domain = vcMfgDomain1
                                             and code_fldname = "xxcip"
                                             and code_value begins "glcode"
                                             and code_cmmt = GL.GLCode  )                                           
       then  
       do:
   
              vc_cipnbr = "".
           global_domain = vcMfgDomain1.
                {us/bbi/gprun.i ""gpnrmgv.p""
                "(""CIPNBR"",
                    input-output vc_cipnbr,
                    output errorst,
                    output errornum)"}.   
             
        put unformatted vc_cipnbr "-" errorst "-" errornum skip.
       find currency of b_PostingLine no-lock no-error.
      find company of b_PostingLine no-lock no-error.
          /*  价差 */
        find pod_det where pod_nbr = b_toAPMatchingLn.APMatchingLnPvodOrder
               and pod_domain = vcMfgDomain1
               and pod_line = b_toAPMatchingLn.APMatchingLnPvodOrderLnNbr
               no-lock no-error.
     if available pod_det and pod__chr10 <> "" then
     do:  
          
          
      run Create_cip_det(input pod_det.pod__chr10,
                         input vc_cipnbr,
                         input b_Posting.PostingDate,
                         input today,
                         input b_Posting.PostingDate,
                         input time ,
                         input "",
                         input company.companycode,
                         input b_Posting.PostingVoucher,
                         input vc_daybook,
                         input b_PostingLine.PostingLineSequence,
                         input b_PostingLine.PostingLineText,
                         input if b_PostingLine.PostingLineDebitLC <> 0 then gl.glcode else "",
                         input if b_PostingLine.PostingLineCreditLC <> 0 then gl.glcode else "",
                         input if b_PostingLine.PostingLineDebitLC <> 0 and avail costcentre then costcentre.costcentrecode else "",
                         input if b_PostingLine.PostingLineCreditLC <> 0 and avail costcentre  then costcentre.costcentrecode else "",
                         input if b_PostingLine.PostingLineDebitLC <> 0 and avail division then division.divisioncode else "",
                         input if b_PostingLine.PostingLineCreditLC <> 0 and avail division then division.divisioncode else "",
                         input if b_PostingLine.PostingLineDebitLC <> 0 and avail project then project.projectcode else "",
                         input if b_PostingLine.PostingLineCreditLC <> 0 and avail project then project.projectcode else "",
                         input if b_PostingLine.PostingLineDebitLC  > 0 then b_PostingLine.PostingLineDebitLC else 0,
                         input if b_PostingLine.PostingLineCreditLC > 0 then b_PostingLine.PostingLineCreditLC else 0,
                         input if b_PostingLine.PostingLineDebitLC < 0 then  - b_PostingLine.PostingLineDebitLC else 0,
                         input if b_PostingLine.PostingLineCreditLC < 0 then - b_PostingLine.PostingLineCreditLC else 0,
                         input "",
                         input 0,
                         input 0,
                         input currency.currencycode,
                         input "",
                         input vc_daybook,
                         input "",
                         input "",
                         input 0,
                         input "",
                         input vcMfgDomain1,
                         input "mfg").

          
          end. /*   if available pod_det and pod__chr10 <> "" then */
            
            
    end. /* if can-find(first code_mstr where code_domain = vcMfgDomain1 */
    
    end. /*  for each b_toAPMatchingLn, */
   
   
   
   
   output close.

END PROCEDURE.
PROCEDURE BAPMatching.ValidateComponentPost.before:

   define variable lvc_apmathingid as character no-undo.
   define variable lvi_return as integer no-undo.
   define variable vcUserLogin1 as character no-undo.
   define variable vcUserName1 as character no-undo.

   define buffer b_sapmatching for t_sAPMatching.
   define buffer b_sAPMatchingLn for t_sAPMatchingLn.
   define variable lvi_msg_nbr   as  integer    no-undo. 
   define variable vcMfgDomain1  as  character  no-undo.
   define variable viReturn      as  INTEGER    NO-UNDO.
   define variable lvi_recnt      as  INTEGER    NO-UNDO.
   define variable lvc_activity  as   character   no-undo.
   define variable lvc_origref   as   character   no-undo.
   define variable lvi_session_id as integer   no-undo.
   define variable lvc_session_id as character no-undo.
   define variable lvh_session    as handle    no-undo.
   define variable lvc_value      as character extent 10 no-undo.
   

   
   
   output to /home/mfg/finlog/prod/BAPMatching/BAPMatching.ValidateComponentPost.before.log.
   
    run getpublicdata(input "vcUserLogin", output vcUserLogin1 , output vireturn).
    run getpublicdata(input "vcUserName", output vcUserName1 , output vireturn).
    run getpublicdata(input "vcMfgDomain", output vcMfgDomain1 , output vireturn).
    
    do lvi_recnt = 1 to 10:
    lvc_value[lvi_recnt] = "".
    end.
    lvi_recnt = 0.
    
    for each b_sapmatching.
    export b_sapmatching.
    lvc_apmathingid = string(b_sapmatching.APMatching_ID).
     put "lvc_apmathingid:" lvc_apmathingid skip.
    end.
     run GetPublicData (input  "viSessionId",
                        output lvc_session_id,
                        output lvi_return).
    assign lvi_session_id = integer(lvc_session_id).

      run ins/ins__session.p persistent set lvh_session.

      run MainBlock in lvh_session
        (input 0,
         input 0,
         input 0,
         input no,
         input "",
         input-output lvi_session_id,
         output lvi_return).   


    if valid-handle(lvh_session)
    then do:
     do lvi_recnt = 1 to 10:
    lvc_value[lvi_recnt] = "".
    end.
    lvi_recnt = 0.
    for each b_sAPMatchingLn :
      export b_sAPMatchingLn.
      find pod_det where pod_nbr = b_sAPMatchingLn.APMatchingLnPvodOrder
               and pod_domain = vcMfgDomain1
               and pod_line = b_sAPMatchingLn.APMatchingLnPvodOrderLnNbr
               no-lock no-error.
     if available pod_det and pod__chr10 <> "" then
     do:
    
         lvi_recnt = lvi_recnt + 1 .
         lvc_value[lvi_recnt] = string(b_sAPMatchingLn.PvoPostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarRatePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.VarUsagePostingLine_ID) + "," + 
                                string(b_sAPMatchingLn.NewExpensePostingLine_ID) + "," + 
                                APMatchingLnPvodIntRef + "," +
                                string(b_sAPMatchingLn.APMatchingLnPvodOrderLnNbr) + "," +
                                pod_det.pod__chr10.
                         
         run SetCharacterValue in lvh_session
            (input "xx_lvc_apmathingid" + string(lvi_recnt)  ,
             input lvc_value[lvi_recnt],
             output lvi_return).		
             
             put unformatted vcMfgDomain1 " " lvi_session_id "  xx_lvc_apmathingid" + string(lvi_recnt)  "," lvc_value[lvi_recnt] "," lvi_return skip.       
             
       end.      
     end.  /*  for each b_sAPMatchingLn : */    
             
    
    run StopInstance in lvh_session
         (input  "SAVE",
          input  "",
          input  "",
          input  no,
          output lvi_return).

         delete procedure lvh_session.
     end. /* if valid-handle(lvh_session) */

    output close.
end procedure.









/*
PROCEDURE BAPMatching.GetPendingVouchersNoLogCharges.after:

	Define variable currentuserID  as character    no-undo.
	Define variable viSessionId    as integer      no-undo.
	Define variable vc             as character    no-undo.
	Define variable viReturn       as integer      no-undo.
	Define variable vh             as handle       no-undo.
   define variable m_dtlst        as Character    no-undo.
   define variable m_rtlst        as Character    no-undo.
   define variable m_cmpid        as character    no-undo.
   define variable m_domain       as character    no-undo.
   define variable m_entity       as character    no-undo.
   define variable m_entityid     like company.company_id no-undo.
   define variable m_entityid1     like company.company_id no-undo.
   output to /home/mfg/finlog/prod/bapmatching/BAPMatching.GetPendingVouchersNoLogCharges.after.log.
   
	run GetPublicData (input "viSessionId", output vc, output viReturn).
	Assign viSessionId = integer(vc).
	run ins/ins__session.p persistent set vh.
	run MainBlock in vh (input 0, input 0, input 0, input no, input "",input-output viSessionId , output viReturn).
  
   /*<<SG01*/
   run GetCharacterValue in vh (input "v_lcentrcv",  output lccurrent, output viReturn).

   
   /* Assign
      m_dtlst = "vcMfgDomain,viCompanyId".
	  */
    put unformatted "lccurrent " lccurrent " " viReturn skip.

   run GetPublicData (input "vcMfgDomain", output m_domain, output viReturn).
   /*
   run GetPublicData (input "vcCompanyCode", output m_entity, output viReturn).
   run GetPublicData (input "viCompanyId", output m_entityid, output viReturn).
   */
   run GetPublicData (input "vgCompanyId ", output m_entityid1, output viReturn).
  /*
	put unformatted "vcMfgDomain: " m_domain  " vcCompanyCode: " m_entity " " viReturn skip.
	put unformatted "viCompanyId: " m_entityid skip.
	put unformatted "vgCompanyId: " m_entityid1 skip.
	*/
	/*
	find first company where company.companycode = m_entity no-lock no-error.
	if available company then m_entityid = company.company_id.
   */
   /* Assign
      global_domain = entry(1,m_rtlst,chr(3))
      m_cmpid       = entry(2,m_rtlst,chr(3)).
     */ 
	 /*
	  put unformatted "global_domain " global_domain "m_entity " m_entity " " "Entity ID:" m_entityid viReturn skip.
	  */
   For First code_mstr where code_domain = m_domain and code_fldname = "Receiver-Match-CUST" and  code_value = "CURR-ENTITY-REC-ONLY"
      and code_cmmt = "yes" no-lock :
   End.
   /*
    put unformatted "code_fldname code_value code_cmmt " code_fldname " "  code_value " " code_cmmt skip.
	*/
   if avail code_mstr  /* and lccurrent = "NO" */ then
   do:
      For each tPendingVoucherAPM where tPendingVoucherAPM.APMatchingLnPvodCompID <> m_entityid1   /* Integer (m_cmpid) */ :
         for each tPendingVoucherTaxAPM where tPendingVoucherTaxAPM.tc_parentRowid = tPendingVoucherAPM.tc_rowid :
		 /*
           export tPendingVoucherTaxAPM.
		   */
		   delete tPendingVoucherTaxAPM.            
         end. /* for each tPendingVoucherTaxAPM where */
         
         for each tPendingVoucherWHTAPM where tPendingVoucherWHTAPM.tc_parentRowid = tPendingVoucherAPM.tc_rowid :
            delete tPendingVoucherWHTAPM.    		
         end. /* for each tPendingVoucherWHTAPM where */

         for each tPendingVoucherHeader where tPendingVoucherHeader.tcPvoDomain =  tPendingVoucherAPM.PvoDomain  and 
                            tPendingVoucherHeader.tiPvoID  = tPendingVoucherAPM.PvoID  :
			/*
			export tPendingVoucherHeader.
			*/
            delete tPendingVoucherHeader.
         end.
		 /*
		 export tPendingVoucherAPM.
         */
		 delete tPendingVoucherAPM.
      End.
   End. /*avail code_mstr*/
   /*SG01>>*/
   /*
 output close. 
 */
  /* 
   /*SG01 below change is done by QAD for CQFJC, to disable this change for other DB using GCM*/
   if not can-find (First code_mstr 
                     where code_domain    = global_domain 
                     and   code_fldname   = "Rcv-Match-Price-CST" 
                     and   code_value     = "Ignore-Cust"
                     and   code_cmmt      = "YES"
                     no-lock) 
/*    and ( can-find (First tt_data no-lock) or v_tempuipai = "UI" ) */
   then do: 
   
      Assign
          lcreprice = "".

      run GetCharacterValue in vh (input "v_lcreprice", output lcreprice, output viReturn). 
      run GetCharacterValue in vh (input "v_lcpostdate",output lcpostdate,output viReturn).
      
        
      if lcreprice = ?
      then do:
         return.
      end.
      
      for each tPendingVoucherAPM:
         tPendingVoucherAPM.APMatchingLnMatchUnitPrice = if t_parameter.ilAutoSelect then tPendingVoucherAPM.APMatchingLnPvodUnitPrice else 0.
         tPendingVoucherAPM.APMatchingLnMatchAmtTC = /*JJ1201 tPendingVoucherAPM.APMatchingLnMatchUnitPrice * tPendingVoucherAPM.APMatchingLnMatchQty. */
            if t_parameter.ilAutoSelect then tPendingVoucherAPM.APMatchingLnPvodOpenAmtTC else 0.
      end.

      if lcreprice <> "yes" then do:
         return.
      end.

      run GetDataItems.

      define variable v_eff_date as date no-undo.
      define variable icDataList as char no-undo.
      define variable ocValues as char no-undo.
      define variable oiReturnStatus  as integer no-undo.
      define variable iiLCId as integer no-undo.

      icDataList = "vcMfgDomain,viSessionId,viSessionId,viCompanyLCId".
      ocValues = "".

      run getPublicData 
         (input icDataList, output ocValues, output oiReturnStatus).


           global_domain = entry(1,ocValues,chr(3)).
           iiLCId = int(entry(4,ocValues,chr(3))).
           find first code_mstr where code_mstr.code_domain = global_domain and
                   code_mstr.code_fldname = "voucher_maintenance" and
                   code_mstr.code_value = "debug" no-lock no-error.
           if avail code_mstr and code_mstr.code_cmmt = "yes" then v_debug = yes.
           else v_debug = no.
      if v_debug then xxx  = xxx + 1.
      if v_debug then output to /tmp/1.log append.
      if v_debug then put unformatted "1 " lcreprice  " " xxx " " viCompanyLCId skip .
      if v_debug then do:
         disp "2" lcreprice viReturn iiLCId.
         find first currency where currency_id = viCompanyLCId /* iiLCId */ no-lock no-error.
         disp "Currency:" .
         if avail currency then disp currencycode.
      end.


      if avail tAPmatching then do:
         /*JJ1201
            v_eff_date = /* tAPmatching.ttCInvoicePostingDate */
            date(lcpostdate).
         */
            if v_debug then disp tAPMatching.CustomCombo0 vcuserLogin v_eff_date.
      end.

      if v_debug then do:
         disp v_eff_date avail tAPMatching ocValues format 'x(40)' vcUserLogin  "YYY"
         with frame x width 255.

         for each t_iAPMatching: export t_iAPMatching.  end.

         for each t_sAPMatching: export t_sAPMatching.  end.
      end.

      define variable newprice 	like pod_pur_cost no-undo.
      define variable pc_recno 	as   recid no-undo.
      define variable dummy_disc 	as   decimal no-undo.
      define variable l_list_price  	like pod_pur_cost no-undo.
      define variable glxcst 		like pod_pur_cost no-undo.
      define variable curcst 		like pod_pur_cost no-undo.

      if v_debug then put unformatted global_user_lang_dir " lang_dir "  search("us/gp/gpsct05.r") skip.

      global_user_lang_dir = 'us/'.


           For each tPendingVoucherAPM break by tPendingVoucherAPM.PvoDomain by tPendingVoucherAPM.PvoID by tPendingVoucherAPM.PvodLineID:

         find first pvo_mstr where pvo_mstr.pvo_domain = global_domain and pvo_mstr.pvo_id = tPendingVoucherAPM.PvoID no-lock no-error.
         if avail pvo_mstr then v_eff_date = pvo_mstr.pvo_trans_date.

         find first pod_det where pod_domain = tPendingVoucherAPM.PvoDomain and
            pod_nbr = tPendingVoucherAPM.APMatchingLnPvodOrder      and
            pod_line = tPendingVoucherAPM.APMatchingLnPvodOrderLnNbr 
            no-lock no-error.

         if not avail pod_det then next.
         if pod_sched = no and not v_debug then next. 

         find po_mstr where po_domain = pod_domain and
            po_nbr = pod_nbr no-lock no-error.

         {us/bbi/gprun.i ""gpsct05.p"" "(
            input 	pod_part,
            input	pod_site,
            input	2,
            output 	glxcst,
            output	curcst)"}
         glxcst = glxcst * pod_um_conv.
         newprice = 0.

         l_list_price = glxcst.


         {us/bbi/gprun.i ""xxgppccal_e.p"" "(
            input        tPendingVoucherAPM.APMatchingLnPvodItem, 
            input        tPendingVoucherAPM.APMatchingLnMatchQty, 
            input        tPendingVoucherAPM.APMatchingLnPvodUoM        , 
            input        tPendingVoucherAPM.APMatchingLnPvodUomConv    , 
            input        tPendingVoucherAPM.APMatchingLnPvodCurrency   , 
            input        {&SUPPLIER-CLASSIFICATION}, 
            input        pod_pr_list, 
            input	     v_eff_date,
            input        glxcst, 
            input        no, 
            input        0.0, 
            input-output l_list_price, 
            output       dummy_disc, 
            input-output newprice, 
            output       pc_recno)"}

         if v_debug then do:
            put unformatted 
         global_domain " gpsct05.p " pod_part " " pod_site " " glxcst " " curcst " " glxcst skip
         "gppccal.p " tPendingVoucherAPM.APMatchingLnPvodItem " " tPendingVoucherAPM.APMatchingLnMatchQty " " 
         tPendingVoucherAPM.APMatchingLnPvodUoM " " tPendingVoucherAPM.APMatchingLnPvodUomConv " "
         tPendingVoucherAPM.APMatchingLnPvodCurrency " " {&SUPPLIER-CLASSIFICATION} " " pod_pr_list " " v_eff_date " " glxcst " "
         l_list_price " " dummy_disc " " newprice " " pc_recno " " skip.
         /*
            newprice = 10.23812.
            */
         end.

         if pc_recno = 0 or newprice = 0 then do:
            for first vp_mstr where vp_mstr.vp_domain = pod_domain and
               vp_part      = pod_part and
               (vp_vend      = po_vend or
               (vp_vend = "" and not can-find(first vp_mstr where
                  vp_domain = vp_domain and
                  vp_part = pod_part and
                  vp_vend = po_vend))) and
               vp_vend_part = pod_vpart no-lock:
               if tPendingVoucherAPM.APMatchingLnMatchQty >= vp_q_qty and
                  pod_um = vp_um and
                  vp_q_price > 0 and
                  po_curr  = vp_curr then
                  tPendingVoucherAPM.APMatchingLnMatchUnitPrice = vp_q_price.
            end.
         end.
         else
         tPendingVoucherAPM.APMatchingLnMatchUnitPrice = newprice.


         tPendingVoucherAPM.APMatchingLnMatchAmtTC = 
            DYNAMIC-FUNCTION("RoundAmount" in vh, tPendingVoucherAPM.APMatchingLnMatchUnitPrice * tPendingVoucherAPM.APMatchingLnMatchQty,?,
            tPendingVoucherAPM.APMatchingLnPvodCurrency).

      

         if v_debug then put unformatted "Data: " tPendingVoucherAPM.APMatchingLnMatchUnitPrice " " tPendingVoucherAPM.APMatchingLnMatchAmtTC skip.

         if last-of(tPendingVoucherAPM.PvodLineID) then do:
                   
         end.
      End.

      if v_debug then
      for each tPendingVoucherTaxAPM:
         disp tPendingVoucherTaxAPM.
      end.

      /* Tax calculation */

      Find tAPMatching where tAPMatching.tc_Rowid = icAPMatchingTcRowid no-lock no-error.
      if v_debug then put "DELETE TAX" skip.
      empty temp-table tPendingVoucherTaxAPM. 
      PGTMCALLINGBLOCK:
      for each tPendingVoucherAPM where 
                           tPendingVoucherAPM.APMatchingLnIsTaxable  = true and 
                 tPendingVoucherAPM.APMatchingLnTaxEnv    <> "" and 
                 tPendingVoucherAPM.APMatchingLnTaxEnv    <> ?  no-lock :
         if v_debug then do:
            put unformatted tPendingVoucherAPM.tc_parentrowid " " string(rowid(tapmatching)) skip.
            put unformatted "ZZZ " icAPMatchingTcRowid " " tPendingVoucherAPM.tc_Rowid " " icCurrencyCode " " 
            "ZZ " iiCInvoiceVoucher " " idCInvoiceTCLCRate  " " idCInvoiceTCLCScale  " " idCInvoiceTCCCRate " " idCInvoiceTCCCScale " " vcCompanyCode
            tAPMatching.ttCInvoiceTaxPointDate " " tAPMatching.APMatchingDate " " idCInvoiceTCLCRate " " idCInvoiceTCLCScale " " idCInvoiceTCCCRate 
            " " idCInvoiceTCCCScale skip
            tPendingVoucherAPM.APMatchingLnTaxEnv " " tPendingVoucherAPM.APMatchingLnTaxClass " " tPendingVoucherAPM.APMatchingLnTaxUsage " "
            tPendingVoucherAPM.APMatchingLnMatchAmtTC " " tAPMatching.APMatchingCInvoiceDiscPct " " tAPMatching.tlCreditorAddrIsTaxInCity 
            " "  tAPMatching.tlShipToAddrIsTaxInCity.
         end.
 
         
              /*BBX20150806 --------------------  */
            run CreateAPMatchingLNTaxFromGTM
            (input  icAPMatchingTcRowid ,
             input  tPendingVoucherAPM.tc_Rowid , 
             input  icCurrencyCode ,
             input  '' ,
             input  iiCInvoiceVoucher ,
             input  '' ,
             input  tPendingVoucherAPM.APMatchingLnIsTaxable ,
             input  False ,
             input  tAPMatching.ttCInvoiceTaxPointDate ,
             input  tAPMatching.APMatchingDate ,
             input  tPendingVoucherAPM.APMatchingLnTaxEnv ,
             input  '' ,
             input  '' ,
             input  tPendingVoucherAPM.APMatchingLnTaxClass ,
             input  tPendingVoucherAPM.APMatchingLnTaxUsage ,
             input  tPendingVoucherAPM.APMatchingLnMatchAmtTC ,
             input  idCInvoiceTCLCRate ,
             input  idCInvoiceTCLCScale ,
             input  idCInvoiceTCCCRate ,
             input  idCInvoiceTCCCScale ,
             input  vcCompanyCode ,
             input  1 ,
             input  tAPMatching.APMatchingCInvoiceDiscPct ,
             input  tAPMatching.tlCreditorAddrIsTaxInCity ,
             input  tAPMatching.tlShipToAddrIsTaxInCity ,
             input  /* False */ True,
             output dataset tAPMatchingLnTaxFromGTM ,
             output dataset tAPMatchingLnWHTFromGTM ,
             output oiReturnStatus) .
            /* -------------------------BBX20150806 */
                
         if oiReturnStatus <  0 then leave PGTMCALLINGBLOCK.

         for each tAPMatchingLnTaxFromGTM :
             find first tPendingVoucherTaxAPM where tPendingVoucherTaxAPM.tc_rowid = tAPMatchingLnTaxFromGTM.tc_rowid no-error.
             if not avail  tPendingVoucherTaxAPM then
                       create tPendingVoucherTaxAPM.
             buffer-copy tAPMatchingLnTaxFromGTM to tPendingVoucherTaxAPM.
         end. /* for each tAPMatchingLnTaxFromGTM */
         empty temp-table tAPMatchingLnTaxFromGTM.
         /*BBX20150806*/ empty temp-table tAPMatchingLnWHTFromGTM.
      end.
   end. /*if can-find*/
  */ 
 run StopInstance in vh  (input "SAVE", input "", input "", input no, output viReturn).
   delete procedure vh.
   /*
   if v_debug then output close.
   */
end.

/*BBX20150806 Upgrade End ------------------------------------*/
PROCEDURE BAPMatching.UICustomization.after:

empty temp-table tUIInput.


END PROCEDURE.

PROCEDURE BAPMatching.UICustomization.before:

   output to /home/mfg/finlog/prod/bapmatching/BAPMatching.UICustomization.before.log.
   v_tempuipai = "API".

   empty temp-table tt_data.

	FOR EACH tUIInput NO-LOCK:
   
      export tUIInput.
      v_tempuipai = "UI".
   
      if not (can-find (first tt_data no-lock))
      then do:
         create tt_data.
         assign tt_rec = "1".
      end.
      
      

		Define variable currentuserID as character no-undo.
		Define variable viSessionId as integer no-undo.
		Define variable vc as character no-undo.
		Define variable viReturn as integer no-undo.
		Define variable vh as handle no-undo.

		run GetPublicData (input "viSessionId", output vc, output viReturn).
		Assign viSessionId = integer(vc).
		run ins/ins__session.p persistent set vh.
		run MainBlock in vh (input 0, input 0, input 0, input no, input "", input-output viSessionId , output viReturn).

		if tcControlName = "SButton" then
         run SetCharacterValue in vh (input "v_lcreprice", tUIInput.tcpropertyvalue, output viReturn). 
		if tcControlName = "PostDate" then
		   run SetCharacterValue in vh  (input "v_lcpostdate",tUIInput.tcpropertyvalue, output viReturn).
      if tcControlName = "SAllEntRcv" then  /*SG01*/
         run SetCharacterValue in vh  (input "v_lcentrcv", tUIInput.tcpropertyvalue, output viReturn).
        
      run StopInstance in vh (input "SAVE", input "", input "", input no, output viReturn).

       
          
          
		delete procedure vh.


		if tcControlName = "SButton"    then  lcReprice = tUIInput.tcpropertyvalue.
      if tcControlName = "SAllEntRcv" then  lccurrent = tUIInput.tcpropertyvalue. /*SG01*/
         put unformatted "lccurrent " lccurrent skip.
	   /*
		if v_debug then xxx = xxx + 1.

		if v_debug then output to /tmp/1.log append.
		if v_debug then disp tUIInput.tcpropertyvalue  xxx.
		if v_debug then output close.
       */
	END.
	output close.
END PROCEDURE.
*/


/*
Procedure: AddAPMatching
Description:
AddAPMatching: Create an APMatching-record based upon the input parameters
Parameters:
input iiCInvoiceID
    (ID of the Invoice)
input icAPMatchingStatus
    ()
input icAPMatchingJournalCode
    (Journal-code to be used for the matching.
If no value is received for this parameter and there is only one journal with the correct type, then that one will be used)
input ilIsUpdateCInvoiceAutomatically
    (Do you want to automatically update the supplier invoice?)
output oiAPMatchingID
    (corresponds with field APMatching_ID of the newly create tAPMatching record)
output ocAPMatchingTcRowid
    (corresponds with field tc_rowid of the newly create tAPMatchign record)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AddAPMatching.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddAPMatching.after:

END PROCEDURE.
**/

/*
Procedure: AddAPMatchingCost
Description:
This method will receive the extra cost posting lines that need to be added in the additional updates.
Parameters:
input dataset tAPMatchingCostFromBCIAPM
    (Pass the additional posting lines for the matching.  The Parent-rowid in here is the rowid of the parent tAPMatching table.)
input dataset tAPMatchingCostSafFromBCIAPM
    (Temp-table to pass the safs for the extra postinglines for the ap matching integration.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AddAPMatchingCost.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddAPMatchingCost.after:

END PROCEDURE.
**/

/*
Procedure: AddAPMatchingLn
Description:
AddAPMatchingLn: Create an APMatchingLn-record based upon the input parameters
Parameters:
input icAPMatchingTcRowid
    (Tc-rowid of the tAPMatching-record for which you want to create detail lines.
Mandatory)
input icDomainCode
    (Domain: this should be the domain that the user logged in on.
if not filled, then the current  domain is used.
Mandatory)
input ilCallGTM
    (CallGTM: set to true in case you want the taxes to be recalculated, set to false if you just want to use the taxes of the pending-voucher.
Note that in case the MatchUnitPrice differs from the PvodUnitPrice or the MatchQty differs from the PvodOpenQty, GTM will be called anyway - even when ilCallGTM is false.)
input ilFillPendingMatchFields
    (FillPendingMatchFields: Set this param to true in case you want to include the assignments for the calculated-fields in tAPMatchingLn that represent the pending matched qty / amount for the pvod that is used on other initial matchings.

These fields are just there for informational-reasons but have no real functionality. So for external, non-UI callers, it is more performing to set this to false)
input-output dataset tAPMatchingLnBasedUponPvod
    (Temp-table containing the Pvod-data and the  APMatchingLn-data: for each entry in this temp-table, an APMatchingLn record will be created)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AddAPMatchingLn.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddAPMatchingLn.after:

END PROCEDURE.
**/

/*
Procedure: AddAPMatchingLnLC
Description:
This method will add logistic charge matching details to the logistic charge.
Parameters:
input icDomainCode
    ()
input ilCallGTM
    ()
input ilFillPendingMatchFields
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AddAPMatchingLnLC.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddAPMatchingLnLC.after:

END PROCEDURE.
**/

/*
Procedure: AddAPMatchingLnNoLC
Description:
This method will add logistic charge matching details to the logistic charge.
Parameters:
input icDomainCode
    ()
input ilCallGTM
    ()
input ilFillPendingMatchFields
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AddAPMatchingLnNoLC.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddAPMatchingLnNoLC.after:

END PROCEDURE.
**/

/*
Procedure: AddAPMatchingLnValidate
Description:
AddAPMatchingLnValidate: Submethod of AddAPMatchingLn holding the validations
Parameters:
input-output bcAPMatchingTcRowid
    (Tc-rowid of the tAPMatching-record for which you want to create detail lines)
input-output bcDomainCode
    (Domain: this should be the domain that the user logged in on.
if not filled, then the current  domain is used)
input-output blCallGTM
    (CallGTM: set to true in case you want the taxes to be recalculated, set to false if you just want to use the taxes of the pending-voucher)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AddAPMatchingLnValidate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddAPMatchingLnValidate.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAll
Description:
AdditionalUpdatesAll
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAll.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAll.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllCosts
Description:
Add additional posting lines that were passed by the integration.
Parameters:
input icAPMatchingPostingRowID
    (Posting Rowid of the matching posting)
input icPostingText
    (Posting Text)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllCosts.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllCosts.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllCreatePLCirec
Description:
AdditionalUpdatesAllCreateCirec; submethod of AdditionalUpdatesAll that is located in the same segment and that takes care of the creation of a cirec-posting-line and the creation of a record in the associated temp-table.
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icCirecGLCode
    ()
input icCirecDivisionCode
    (CirecDivisionCode)
input icPostingText
    (PostingText)
input idSumPosVarUsageTCPosVarRateTC
    (SumPosVarUsageTCPosVarRateTC: this field will be used to raise the HoldAmount of the invoice and should thus be in the currency of the invoice)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllCreatePLCirec.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllCreatePLCirec.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllExt
Description:
AdditionalUpdatesAllExt
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllExt.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllExt.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllExtCInvoice
Description:
AdditionalUpdatesAllExtCInvoice; sub-method of AdditionalUpdatesAll that handles all actions regarding this external class
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllExtCInvoice.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllExtCInvoice.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllExtQCrossCyPosting
Description:
This method creates new request for cross company daemon.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllExtQCrossCyPosting.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllExtQCrossCyPosting.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLines
Description:
AdditionalUpdatesAllLines; submethod of AdditionalUpdatesAll that is located in the same segment and that takes care of the loop on the tAPMatchingLn record of a single tAPMatching record
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icPostingText
    (PostingText)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLines.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLines.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesDefSafOper
Description:
Overtake operational values from result of executed query tqPendingVoucherForMatchingAcc and make new default Operational SAF values. They are stored in tDefaultSafsOperAPM class temporary table.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesDefSafOper.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesDefSafOper.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLAddPostingLine
Description:
This method creates normal or cross company posting-lines
Parameters:
input icAPMatchingPostingRowId
    ()
input icGLCode
    ()
input icDivisionCode
    ()
input icCostCentreCode
    ()
input icProjectCode
    ()
input icOpAllocCode
    (Operational Allocation Code. If this parameter is passed several posting lines will be created based on the number of detail lines linked to the operational allocation code.  The GL Code that is passed will not be used.)
input idDebitTC
    ()
input idDebitLC
    ()
input idDebitCC
    ()
input idCreditTC
    ()
input idCreditLC
    ()
input idCreditCC
    ()
input icPostingText
    ()
input idTCLCExchangeRate
    ()
input idTCLCExchangeScale
    ()
input idTCCCExchangeRate
    ()
input idTCCCExchangeScale
    ()
input dataset tDefaultSafsAPM
    ()
output oiPostingLineId
    ()
input ilisCallForVarianceOrTax
    (This parameter is true when calling method for Variance account  or Tax Account)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLine.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLine.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLAddPostingLineOpAllocCode
Description:
This method creates a posting line for each gl linked to the Operational Allocation Code that is used.  It will split the amounts according to the percentages used in the Operational Allocation Code setup.
Parameters:
input icAPMatchingPostingRowId
    ()
input icGLCode
    ()
input icDivisionCode
    ()
input icCostCentreCode
    ()
input icProjectCode
    ()
input icOpAllocCode
    (Operational Allocation Code. If this parameter is passed several posting lines will be created based on the number of detail lines linked to the operational allocation code.  The GL Code that is passed will not be used.)
input idDebitTC
    ()
input idDebitLC
    ()
input idDebitCC
    ()
input idCreditTC
    ()
input idCreditLC
    ()
input idCreditCC
    ()
input icPostingText
    ()
input idTCLCExchangeRate
    ()
input idTCLCExchangeScale
    ()
input idTCCCExchangeRate
    ()
input idTCCCExchangeScale
    ()
input dataset tDefaultSafsAPM
    ()
output oiPostingLineId
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLineOpAllocCode.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLAddPostingLineOpAllocCode.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLExpenseAcruals
Description:
AdditionalUpdatesAllLinesPLExpenseAcruals; submethod of AdditionalUpdatesAllLines that is located in the same segment and that takes care of the creation of 2 posting-lines on accrual-aacounts for the logistic-charges
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icPostingText
    (PostingText)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLExpenseAcruals.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLExpenseAcruals.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLReceiptPvod
Description:
AdditionalUpdatesAllLinesPLReceiptPvod; submethod of AdditionalUpdatesAllLines that is located in the same segment and that takes care of the creation of a posting-line for the Pvod_det in case of non-logistic-charges
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icPostingText
    (Posting Text)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLReceiptPvod.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLReceiptPvod.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLVarExchRate
Description:
AdditionalUpdatesAllLinesPLVarExchRate; submethod of AdditionalUpdatesAllLines that is located in the same segment and that takes care of the creation of a posting-line for the ExchangeRateVariance (difference in exch-rates between invoice and receipt)
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icPostingText
    (PostingText)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarExchRate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarExchRate.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLVarExchRateAccount
Description:
AdditionalUpdatesAllLinesPLVarExchRateAccount; submethod of AdditionalUpdatesAllLinesPLVarExchRate that is located in the same segment and that takes care of the creation of a posting-line for the ExchangeRateVariance (difference in exch-rates between invoice and receipt)
Parameters:
input ilGetGainAccount
    (If you want this method to return you the account used for GAINS then pass true
If you want this method to return you the account used for LOSSES then pass false or unknown

FYI: if the CreditLC is postive then this means a Gain)
output ocGLCode
    ()
output ocDivisionCode
    ()
output ocCostCentreCode
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarExchRateAccount.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarExchRateAccount.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLVarRate
Description:
AdditionalUpdatesAllLinesPLVarRate; submethod of AdditionalUpdatesAllLines that is located in the same segment and that takes care of the creation of a posting-line for the RateVariance (difference in price)
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icPostingText
    (Posting Text)
output ocNormalRateVarGLCode
    ()
output ocNormalRateVarDivisionCode
    ()
output ocNormalRateVarCostCentreCode
    (CostCentreCode)
output ocDiscrepancyGLCode
    ()
output ocDiscrepancyDivisionCode
    ()
output ocDiscrepancyCostCentreCode
    ()
output ocLogRateVarGLCode
    ()
output ocLogRateVarDivisionCode
    ()
output ocLogRateVarCostCentreCode
    ()
output ocPPVGLCode
    ()
output ocPPVDivCode
    ()
output ocPPVCCCode
    ()
output ocRateVarGLCode
    ()
output ocRateVarDivisionCode
    ()
output ocRateVarCostCentreCode
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarRate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarRate.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLVarUsage
Description:
AdditionalUpdatesAllLinesPLVarUsage; submethod of AdditionalUpdatesAllLines that is located in the same segment and that takes care of the creation of a posting-line for the UsageVariance (difference in qty)
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icPostingText
    (PostingText)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarUsage.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarUsage.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLVarUsageSub1
Description:
AdditionalUpdatesAllLinesPLVarUsageSub1; submethod of AdditionalUpdatesAllLinesPLVarUsage that is located in the same segment and that takes care of the validation of the input for that method
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarUsageSub1.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarUsageSub1.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllLinesPLVarUsageSub2
Description:
AdditionalUpdatesAllLinesPLVarUsageSub2; submethod of AdditionalUpdatesAllLinesPLVarUsage that is located in the same segment and that takes care of the creation of a posting-line for the UsageVariance (difference in qty)
Parameters:
input icAPMatchingPostingRowidID
    (APMatchingPostingRowidID)
input icPostingText
    (PostingText)
input icGLCode
    ()
input icDivisionCode
    ()
input icCostCentreCode
    ()
input icProjectCode
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarUsageSub2.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllLinesPLVarUsageSub2.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllQueriesStart
Description:
AdditionalUpdatesAllQueriesStart: Submethod of AdditionalUpdatesAll that is in the same segment and that makes sure queries are started before a major loop is run.
Note that also StartComponent in a class is started as repetitively an instance-less method in that class is run.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllQueriesStart.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllQueriesStart.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllQueriesStop
Description:
AdditionalUpdatesAllQueriesStop: Submethod of AdditionalUpdatesAll that is in the same segment and that makes sure queries are stopped after a major loop is run.
Note that also EndComponent in a class is started as repetitively an instance-less method in that class is run.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllQueriesStop.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllQueriesStop.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllTax
Description:
AdditionalUpdatesAllTax
Parameters:
input icAPMatchingPostingRowID
    ()
input icPostingText
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTax.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTax.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllTaxGetInvAcc
Description:
AdditionalUpdatesAllTaxNewGetInvAcc: submethod of AdditionalUpdatesAllTaxNew that assigns the inventory-account (and division and CC)
Parameters:
output ocInvAccGLCode
    ()
output ocInvAccDivCode
    ()
output ocInvAccCCCode
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxGetInvAcc.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxGetInvAcc.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllTaxGetPPV
Description:
AdditionalUpdatesAllTaxNewGetPPV: submethod of AdditionalUpdatesAllTaxNew that assigns the PPV-account (and division and CC) in the calc-fields of APMatchingLn
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxGetPPV.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxGetPPV.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllTaxNewOne
Description:
AdditionalUpdatesAllTaxNew
Parameters:
input icAPMatchingPostingRowidID
    (Rowid of the posting)
input icPostingText
    (Text of the posting)
input-output bdTaxARNRecTC
    ()
input-output bdTaxAINRecTC
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxNewOne.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxNewOne.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllTaxNewTwo
Description:
AdditionalUpdatesAllTaxNew
Parameters:
input icAPMatchingPostingRowidID
    (Rowid of the posting)
input icPostingText
    (Text of the posting)
input-output bdTaxARNRecTC
    ()
input-output bdTaxAINRecTC
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxNewTwo.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxNewTwo.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllTaxOldOne
Description:
AdditionalUpdatesAllTaxOldl: submethod of AdditionalUpdatesAll that will reverse the taxes of the matched pvo
Parameters:
input icAPMatchingPostingRowidID
    (Rowid of the posting)
input icPostingText
    (Text of the posting)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxOldOne.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxOldOne.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdatesAllTaxOldTwo
Description:
AdditionalUpdatesAllTaxOldl: submethod of AdditionalUpdatesAll that will reverse the taxes of the matched pvo
Parameters:
input icAPMatchingPostingRowidID
    (Rowid of the posting)
input icPostingText
    (Text of the posting)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxOldTwo.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdatesAllTaxOldTwo.after:

END PROCEDURE.
**/

/*
Procedure: ApiGetAPMatchingLnByPvo
Description:
This method retrives all AP Matching records for certain Pending voucher
Parameters:
input iiPvoId
    (Pending voucher Id)
input iiPvoLineId
    (Pending voucher Lind Id)
output dataset tAPMatchingLnByPvo
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiGetAPMatchingLnByPvo.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiGetAPMatchingLnByPvo.after:

END PROCEDURE.
**/

/*
Procedure: ApiGetMatchingInfoBySiteItem
Description:
ApiGetMatchingInfoBySiteItem;
non-remoring but api-enabled method that returns information for a bunch of receipts based upon the parameters
Parameters:
input icDomainCode
    ()
input icSite
    (Site of the receipt)
input icPart
    (Item of the receipt)
input itReceiptDateFrom
    (From receipt date)
input itReceiptDateTill
    (Till receipt date)
output dataset tMatchingInfoBySiteItem
    (Temp-table holding the matching-infoprmation base upon the input values)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiGetMatchingInfoBySiteItem.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiGetMatchingInfoBySiteItem.after:

END PROCEDURE.
**/

/*
Procedure: ApiGetMatchingInfoMulti
Description:
This method returns APMatching information for mutliple purchase order receipts.  It is primarily aimed at the PO Unvourched receipt program.  It takes input parameters that are used to start the query at prh_hist
Parameters:
input icDomainCode
    ()
input icSupplierCodeFrom
    ()
input icSupplierCodeTo
    ()
input icItemFrom
    ()
input icItemTo
    ()
input itEffectiveDate
    ()
input itReceiptsFromDate
    ()
input icSiteFrom
    ()
input icSiteTo
    ()
input icPoSiteFrom
    ()
input icPoSiteTo
    ()
input ilSelectInventoryItems
    ()
input ilSelectSubcontractItems
    ()
input ilSelectMemoItems
    ()
input icReportCurrency
    ()
output dataset tAPMatchingInfo
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiGetMatchingInfoMulti.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiGetMatchingInfoMulti.after:

END PROCEDURE.
**/

/*
Procedure: ApiIsLogisticsMatchingActive
Description:
This method checks, whether logistics accounting is active or not.
Parameters:
output olIsLogisticsAccountingActive
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiIsLogisticsMatchingActive.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiIsLogisticsMatchingActive.after:

END PROCEDURE.
**/

/*
Procedure: CalculatePost
Description:
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CalculatePost.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CalculatePost.after:

END PROCEDURE.
**/

/*
Procedure: CalculatePostAPMLn
Description:
CalculatePostAPMLn: submethod of CalculatePost that is in the same segment.
This was done as the complete method became too big.
Parameters:
input ilUseDelTax
    (True in case delayed taxes are applicable for the domain)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CalculatePostAPMLn.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CalculatePostAPMLn.after:

END PROCEDURE.
**/

/*
Procedure: CalculatePostAPMLnQuery
Description:
CalculatePostAPMLnQuery: submethod of CalculatePostAPMLn that is in the same segment.
This was done as the complete method became too big.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CalculatePostAPMLnQuery.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CalculatePostAPMLnQuery.after:

END PROCEDURE.
**/

/*
Procedure: CancelAPMatching
Description:
This method cancels the AP Matchings related to specified Supplier Invoice
Parameters:
input iiCInvoiceId
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CancelAPMatching.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CancelAPMatching.after:

END PROCEDURE.
**/

/*
Procedure: CheckCICirecAmountAgainstMatched
Description:
This method checks the Cirec Amount for SI Posting and APMatching
Parameters:
input iiAPMatchingID
    ()
input iiCInvoiceID
    ()
input iiReasonID
    ()
input icReasonCode
    ()
input iiCIPostingYear
    ()
input icCIJournalCode
    ()
input iiCIVoucher
    ()
input idAPMatchingTotalAmountTC
    ()
input idAPMatchingTotalAmountLC
    ()
input idAPMatchingAIRecTaxTC
    (APMatchingAIRecTaxTC: recoverable taxes accrued at invoices)
output odCirecCInvoiceAmountTC
    ()
output odCirecCInvoiceAmountLC
    ()
output odAPMatchingARRecTaxTC
    ()
output odAPMatchingARNRecTaxTC
    ()
output odAPMatchingAIRecTaxTC
    ()
output odAPMatchingAINRecTaxTC
    ()
output odInvoiceDiscountPercentage
    ()
input ilBCInvoiceIsAlreadyOpen
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CheckCICirecAmountAgainstMatched.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CheckCICirecAmountAgainstMatched.after:

END PROCEDURE.
**/

/*
Procedure: CopyIntoNew
Description:
This method accepts APMatching_ID and create a copy of this AP matching.
Parameters:
input iiOriginalAPMId
    ()
input ilClearData
    ()
input ilRemoveOriginalAPM
    ()
output ocNewAPMRowid
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CopyIntoNew.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CopyIntoNew.after:

END PROCEDURE.
**/

/*
Procedure: CreateAPMatchingLNTaxFromGTM
Description:
CreateAPMatchingLNTaxFromGTM; this public and remoting-enabled method will be called from GetPendingVouchers and from the UI.
Input: all required information for calling GTM
Output: temp-table like APMatchingLnTax
Parameters:
input icAPMatchingTcRowid
    (Tc_rowid field of the APMatching record that holds this matching data)
input icAPMatchingLnTcRowid
    (Tc_rowid field of the APMatchingLn record that is the parent for the new output temp-table  records in APMatchingLnTaxFromGTM)
input icCurrencyCode
    (Currency code)
input icTransactionType
    (Transaction type (use preprocessors for this))
input icDocumentReference
    (DocumentReference)
input icDocumentNumber
    (DocumentNumber)
input ilIsTaxable
    (Is this taxable)
input ilIsTaxIncludedInTheAmount
    (IsTaxIncluded)
input itTaxPointDate
    (Date used for the tax calculations)
input itPostingDate
    (Date of the posting that will hold these taxes)
input icTaxEnvCode
    (TaxEnvCode)
input icFromTaxZoneCode
    (FromTaxZoneCode)
input icToTaxZoneCode
    (ToTaxZoneCode)
input icTaxClassCode
    (TaxClassCode)
input icTaxUsageCode
    (TaxUsageCode)
input idAmountTC
    (Invoice amount with or without taxes (depending upon IsTaxIncludedInTheAmount))
input idCInvoiceTCLCRate
    (ExchangeRate)
input idCInvoiceTCLCScale
    (ExchangeRateScale)
input idCInvoiceTCCCRate
    ()
input idCInvoiceTCCCScale
    (CInvoiceTCCCScale)
input icCompanyCode
    (CompanyCode)
input idAdjustmentFactor
    (AdjustmentFactor: should be 1 when the discount-at-invoice-percentage is passed)
input idPaymentConditionPercentage
    (PaymentConditionPercentage of the discount at invoice)
input ilIsTaxInCityOfShipTo
    (IsTaxInCityOfShipTo: true in case the TaxInCity flag of the ship-to address is true)
input ilIsTaxInCityOfShipFrom
    (IsTaxInCityOfShipFrom: true in case the TaxInCity flag of the ship-from address is true)
input ilNeedToStartPGTMFromHere
    (NeedToStartPGTMFromHere: pass false in case the caller has already started and opened class PGTM)
output dataset tAPMatchingLnTaxFromGTM
    (Temp-table containing the information returned by GTM converted to the format of APMatchingLnTax records)
output dataset tAPMatchingLnWHTFromGTM
    (Temp-table containing the information returned by GTM converted to the format of APMatchingLnWHT records)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CreateAPMatchingLNTaxFromGTM.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CreateAPMatchingLNTaxFromGTM.after:

END PROCEDURE.
**/

/*BBX20150806  Upgrade start --------------*/
/*JJ*/
/*
PROCEDURE BAPMatching.CreateAPMatchingLNTaxFromGTM.before:


END PROCEDURE.
*/
/*BBX20150806  Upgrade end --------------*/

/*
Procedure: CreateMatchingPosting
Description:
Parameters:
input icAPMatchingTcRowid
    (APMatchingTcRowid)
input iiMatchingYear
    ()
input iiMatchingPeriod
    ()
input icMatchingJournal
    ()
input itMatchingDate
    ()
input icCInvoiceReference
    ()
output oiPostingId
    ()
output ocPostingTcRowid
    (tc_rowid of the new tposting record)
input-output biPostingVoucher
    ()
output oiJournalEntryInstanceId
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CreateMatchingPosting.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CreateMatchingPosting.after:

END PROCEDURE.
**/

/*
Procedure: DefaultValuesDate
Description:
This is a remoting-enabled method that returns the year and period based upon a certain date
Parameters:
input-output btDate
    ()
output oiYear
    ()
output oiPeriod
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DefaultValuesDate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DefaultValuesDate.after:

END PROCEDURE.
**/

/*
Procedure: DefaultValuesInvoice
Description:
This is a remoting-enabled method that returns a bunch of information of the invoice.
Parameters:
input icAPMatchingTcRowid
    (Field tc_rowid of the tAPMatching record these defaults are retrieved for.)
input-output biInvoiceYear
    ()
input-output bcInvoiceJournal
    ()
input-output biInvoiceVoucher
    ()
input-output bcInvoiceReference
    ()
input-output biInvoiceRegistrationNr
    ()
input-output bcCreditorCode
    ()
input iiOldReasonID
    (Reason-id of the invoice before the invoice is matched)
input-output biNewReasonID
    (NewReasonID: Default value for the new reason-ID of the invoice once it is matched)
input-output bcNewReasonCode
    (NewReasonCode: Default value for the new reason-code of the invoice once it is matched)
output oiBusinessRelationID
    (ID of business relation)
output ocBusinessRelationCode
    ()
output ocBusinessRelationICCode
    (BusinessRelationICCode)
output ocCurrencyCode
    ()
output odAmountToMatchTC
    ()
output odAmountToMatchLC
    ()
output oiCInvoiceId
    ()
output odCInvoiceExchangeRate
    ()
output odCInvoiceRateScale
    ()
output odCInvoiceCCRate
    (CInvoiceCCRate: ExchangeRate between TC and SC as specified on the invoice)
output odCInvoiceCCScale
    (CInvoiceCCScale: Exchange-rate Scale between TC and SC as specified on the invoice)
output odCInvoiceLCCCRate
    (Rate between LC and SC at the moment of the invoice (type: Statutory - optional: accounting))
output odCInvoiceLCCCScale
    (Scale between LC and SC at the moment of the invoice (type: Statutory - optional: accounting))
output otCInvoiceDate
    ()
output otCInvoicePostingDate
    (PostingDate of the invoice)
output otCInvoiceTaxPointDate
    (Taxpoint date of the invoice)
output ocCInvoiceType
    (Type of the invoice (credit-note, invoice,  ...))
output ocCInvoicePaymentCondition
    (Payment Condition of the Invoice)
output olCInvoiceIsInitialStatus
    ()
output odTaxAcrueReceiptRecovTC
    ()
output odTaxAcrueReceiptNonRecovTC
    ()
output odTaxAcrueInvoiceRecovTC
    ()
output odTaxAcrueInvoiceNonRecovTC
    ()
output odInvoiceDiscountPercentage
    ()
output ocCreditorAddrTaxIDFederal
    ()
output ocCreditorAddrTaxIDState
    ()
output ocCreditorAddrTaxIDMisc1
    ()
output ocCreditorAddrTaxIDMisc2
    ()
output ocCreditorAddrTaxIDMisc3
    ()
output olCreditorAddrIsTaxInCity
    ()
output olCreditorAddrIsEUCountry
    ()
output ocCreditorAddrCountryCode
    ()
output oiCreditorAddrID
    (Head Office Address ID of the Creditor)
output ocShipToAddrTaxIDFederal
    ()
output ocShipToAddrTaxIDState
    ()
output ocShipToAddrTaxIDMisc1
    ()
output ocShipToAddrTaxIDMisc2
    ()
output ocShipToAddrTaxIDMisc3
    ()
output oiShipToAddrTaxDeclarat
    ()
output olShipToAddrIsTaxInCity
    ()
output olShipToAddrIsEUCountry
    ()
output ocShipToAddrCountryCode
    ()
output oiOriginalAPMatchingID
    ()
output dataset tOrderFilterAPM
    (Temp-table containing the matching-scope of the invocie)
output otPostingDate
    (Posting Date)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DefaultValuesInvoice.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DefaultValuesInvoice.after:

END PROCEDURE.
**/

/*
Procedure: DefaultValuesInvoiceAmount
Description:
this is a remoting-enabled method that returns the amounts to match of the invoice
Parameters:
input iiCInvoiceID
    ()
input iiAPMatchingID
    ()
input iiOldReasonID
    (OldReasonID: Reason-ID of the invoice before it is matched)
input-output biNewReasonID
    (NewReasonID: Default value for the new reason-id of the invoice once it is matched)
input-output bcNewReasonCode
    (NewReasonCode: Default value for the new reason-code of the invoice once it is matched)
output ocCurrency
    (This will contain the currenciy used in the CI.)
output odAmountToMatchTC
    ()
output odAmountToMatchLC
    ()
output odTaxAcrueReceiptRecovTC
    (Tax arruet at receipt, recoverable)
output odTaxAcrueReceiptNonRecovTC
    ()
output odTaxAcrueInvoiceRecovTC
    ()
output odTaxAcrueInvoiceNonRecovTC
    ()
output odInvoiceDiscountPercentage
    ()
input ilBCInvoiceIsAlreadyOpen
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DefaultValuesInvoiceAmount.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DefaultValuesInvoiceAmount.after:

END PROCEDURE.
**/

/*
Procedure: DefaultValuesModifyInitialMatching
Description:
DefaultValuesModifyInitialMatching: method that should be called from the UI in case a modify-action is done for an initial mathcing. It will return the list of PO's that are linked to the invoice
Parameters:
input icAPMatchingTcRowid
    (Rowid of the current matching record)
input iiCInvoiceID
    (ID of the CInvoice)
output dataset tOrderFilterAPM
    (List of PO's that are linked to the invoice.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DefaultValuesModifyInitialMatching.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DefaultValuesModifyInitialMatching.after:

END PROCEDURE.
**/

/*
Procedure: GetAPMatchingPostingVoucherByTcRowid
Description:
GetAPMatchingPostingVoucherByTcRowid: This method will return the postingvoucher for a certain APM based on it tcRowid
Parameters:
input icAPMatchingTcRowid
    (tc_rowid of the tAPMatching for which you want to know the matching-voucher)
output oiAPMatchingPostingVoucher
    (APMatchingPostingVoucher: Matching-Voucher of the tAPMatching record)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetAPMatchingPostingVoucherByTcRowid.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetAPMatchingPostingVoucherByTcRowid.after:

END PROCEDURE.
**/

/*
Procedure: GetGLPLVarRate
Description:
AdditionalUpdatesAllLinesPLVarRate; submethod of AdditionalUpdatesAllLines that is located in the same segment and that takes care of the creation of a posting-line for the RateVariance (difference in price)
Parameters:
input icAPMatchingLnGLCode
    ()
input icAPMatchingLnDivCode
    ()
input icAPMatchingLnCCCode
    ()
input ilAPMatchingLnIsVarGLPosting
    ()
input idAPMatchingLnMatchQty
    ()
input idAPMatchingLnMatchUnitPrice
    ()
input icAPMatchingLnPvodCCCode
    ()
input icAPMatchingLnPvodCostMtdCur
    ()
input icAPMatchingLnPvodCostMtdGL
    ()
input icAPMatchingLnPvodDivCode
    ()
input icAPMatchingLnPvodGLCode
    ()
input ilAPMatchingLnPvodIsLgCharge
    ()
input icAPMatchingLnPvodItem
    ()
input icAPMatchingLnPvodItemType
    ()
input icAPMatchingLnPvodLgCharge
    ()
input icAPMatchingLnPvodPrjCode
    ()
input idAPMatchingLnPvodReceiptQty
    ()
input icAPMatchingLnPvodSite
    ()
input idAPMatchingLnPvodUnitPrice
    ()
input idAPMatchingLnVarRateTC
    ()
input icPvoDomain
    ()
input iiPvoId
    ()
input iiPvodLineID
    ()
input icQADC01
    ()
input icQADC02
    ()
input icpod_loc
    ()
input iipod_op
    ()
input icpod_wo_Lot
    ()
input icprh_site
    ()
input icprh_type
    ()
input icprh_vend
    ()
input icpt_prod_line
    ()
input icpt_site
    ()
input icpvo_order_type
    ()
input icpvo_shipfrom
    ()
input icpvo_shipto
    ()
input icpvod_channel
    ()
input icpvod_shipto
    ()
input icvd_type
    ()
output ocNormalRateVarGLCode
    ()
output ocNormalRateVarDivisionCode
    ()
output ocNormalRateVarCostCentreCode
    ()
output ocDiscrepancyGLCode
    ()
output ocDiscrepancyDivisionCode
    ()
output ocDiscrepancyCostCentreCode
    ()
output ocLogRateVarGLCode
    ()
output ocLogRateVarDivisionCode
    ()
output ocLogRateVarCostCentreCode
    ()
output ocPPVGLCode
    ()
output ocPPVDivCode
    ()
output ocPPVCCCode
    ()
output ocRateVarGLCode
    ()
output ocRateVarDivisionCode
    ()
output ocRateVarCostCentreCode
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetGLPLVarRate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetGLPLVarRate.after:

END PROCEDURE.
**/

/*
Procedure: GetGLPLVarRateAvgCosting
Description:
AdditionalUpdatesAllLinesPLVarRateLAvgCosting; submethod of AdditionalUpdatesAllLinesPLVarRate that is located in the same segment. This method takes about find thie correct accounting information to create a posting-line for the Rate-Variance (difference in price) for NON-Logistic-charges and NON-discrepancy.
Parameters:
input icAPMatchingLnGLCode
    ()
input icAPMatchingLnDivCode
    ()
input icAPMatchingLnCCCode
    ()
input ilAPMatchingLnIsVarGLPosting
    ()
input idAPMatchingLnMatchQty
    ()
input idAPMatchingLnMatchUnitPrice
    ()
input icAPMatchingLnPvodCCCode
    ()
input icAPMatchingLnPvodCostMtdCur
    ()
input icAPMatchingLnPvodCostMtdGL
    ()
input icAPMatchingLnPvodDivCode
    ()
input icAPMatchingLnPvodGLCode
    ()
input ilAPMatchingLnPvodIsLgCharge
    ()
input icAPMatchingLnPvodItem
    ()
input icAPMatchingLnPvodItemType
    ()
input icAPMatchingLnPvodLgCharge
    ()
input icAPMatchingLnPvodPrjCode
    ()
input idAPMatchingLnPvodReceiptQty
    ()
input icAPMatchingLnPvodSite
    ()
input idAPMatchingLnPvodUnitPrice
    ()
input idAPMatchingLnVarRateTC
    ()
input icPvoDomain
    ()
input icQADC01
    ()
input icQADC02
    ()
input icpod_loc
    ()
input iipod_op
    ()
input icpod_wo_Lot
    ()
input icprh_site
    ()
input icprh_type
    ()
input icprh_vend
    ()
input icpt_prod_line
    ()
input icpt_site
    ()
input icpvo_order_type
    ()
input icpvo_shipfrom
    ()
input icpvo_shipto
    ()
input icpvod_channel
    ()
input icpvod_shipto
    ()
input icvd_type
    ()
output ocGLCode
    ()
output ocDivisionCode
    ()
output ocCostCentreCode
    (CostCentreCode)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetGLPLVarRateAvgCosting.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetGLPLVarRateAvgCosting.after:

END PROCEDURE.
**/

/*
Procedure: GetGLPLVarRateDiscrepancy
Description:
AdditionalUpdatesAllLinesPLVarRateDiscrepancy; submethod of AdditionalUpdatesAllLinesPLVarRate that is located in the same segment. This method takes about find thie correct accounting information to create a posting-line for the Rate-Variance (difference in price) for NON-Logistic-charges and Discrepancy.
Parameters:
input icAPMatchingLnGLCode
    ()
input icAPMatchingLnDivCode
    ()
input icAPMatchingLnCCCode
    ()
input ilAPMatchingLnIsVarGLPosting
    ()
input idAPMatchingLnMatchQty
    ()
input idAPMatchingLnMatchUnitPrice
    ()
input icAPMatchingLnPvodCCCode
    ()
input icAPMatchingLnPvodCostMtdCur
    ()
input icAPMatchingLnPvodCostMtdGL
    ()
input icAPMatchingLnPvodDivCode
    ()
input icAPMatchingLnPvodGLCode
    ()
input ilAPMatchingLnPvodIsLgCharge
    ()
input icAPMatchingLnPvodItem
    ()
input icAPMatchingLnPvodItemType
    ()
input icAPMatchingLnPvodLgCharge
    ()
input icAPMatchingLnPvodPrjCode
    ()
input idAPMatchingLnPvodReceiptQty
    ()
input icAPMatchingLnPvodSite
    ()
input idAPMatchingLnPvodUnitPrice
    ()
input idAPMatchingLnVarRateTC
    ()
input icPvoDomain
    ()
input iiPvoId
    ()
input iiPvodLineID
    ()
input icQADC01
    ()
input icQADC02
    ()
input icpod_loc
    ()
input iipod_op
    ()
input icpod_wo_Lot
    ()
input icprh_site
    ()
input icprh_type
    ()
input icprh_vend
    ()
input icpt_prod_line
    ()
input icpt_site
    ()
input icpvo_order_type
    ()
input icpvo_shipfrom
    ()
input icpvo_shipto
    ()
input icpvod_channel
    ()
input icpvod_shipto
    ()
input icvd_type
    ()
output ocGLCode
    ()
output ocDivisionCode
    ()
output ocCostCentreCode
    (CostCentreCode)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetGLPLVarRateDiscrepancy.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetGLPLVarRateDiscrepancy.after:

END PROCEDURE.
**/

/*
Procedure: GetGLPLVarRateLogCharge
Description:
AdditionalUpdatesAllLinesPLVarRateLogCharge; submethod of AdditionalUpdatesAllLinesPLVarRate that is located in the same segment. This method takes about find thie correct accounting information to create a posting-line for the Rate-Variance (difference in price) for Logistic-charges.
Parameters:
input icAPMatchingLnGLCode
    ()
input icAPMatchingLnDivCode
    ()
input icAPMatchingLnCCCode
    ()
input ilAPMatchingLnIsVarGLPosting
    ()
input idAPMatchingLnMatchQty
    ()
input idAPMatchingLnMatchUnitPrice
    ()
input icAPMatchingLnPvodCCCode
    ()
input icAPMatchingLnPvodCostMtdCur
    ()
input icAPMatchingLnPvodCostMtdGL
    ()
input icAPMatchingLnPvodDivCode
    ()
input icAPMatchingLnPvodGLCode
    ()
input ilAPMatchingLnPvodIsLgCharge
    ()
input icAPMatchingLnPvodItem
    ()
input icAPMatchingLnPvodItemType
    ()
input icAPMatchingLnPvodLgCharge
    ()
input icAPMatchingLnPvodPrjCode
    ()
input idAPMatchingLnPvodReceiptQty
    ()
input icAPMatchingLnPvodSite
    ()
input idAPMatchingLnPvodUnitPrice
    ()
input idAPMatchingLnVarRateTC
    ()
input icPvoDomain
    ()
input icQADC01
    ()
input icQADC02
    ()
input icpod_loc
    ()
input iipod_op
    ()
input icpod_wo_Lot
    ()
input icprh_site
    ()
input icprh_type
    ()
input icprh_vend
    ()
input icpt_prod_line
    ()
input icpt_site
    ()
input icpvo_order_type
    ()
input icpvo_shipfrom
    ()
input icpvo_shipto
    ()
input icpvod_channel
    ()
input icpvod_shipto
    ()
input icvd_type
    ()
output ocGLCode
    ()
output ocDivisionCode
    ()
output ocCostCentreCode
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetGLPLVarRateLogCharge.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetGLPLVarRateLogCharge.after:

END PROCEDURE.
**/

/*
Procedure: GetGLPLVarRateNormal
Description:
AdditionalUpdatesAllLinesPLVarRateLNorma;; submethod of AdditionalUpdatesAllLinesPLVarRate that is located in the same segment. This method takes about find thie correct accounting information to create a posting-line for the Rate-Variance (difference in price) for NON-Logistic-charges and NON-discrepancy.
Parameters:
input icAPMatchingLnGLCode
    ()
input icAPMatchingLnDivCode
    ()
input icAPMatchingLnCCCode
    ()
input ilAPMatchingLnIsVarGLPosting
    ()
input idAPMatchingLnMatchQty
    ()
input idAPMatchingLnMatchUnitPrice
    ()
input icAPMatchingLnPvodCCCode
    ()
input icAPMatchingLnPvodCostMtdCur
    ()
input icAPMatchingLnPvodCostMtdGL
    ()
input icAPMatchingLnPvodDivCode
    ()
input icAPMatchingLnPvodGLCode
    ()
input ilAPMatchingLnPvodIsLgCharge
    ()
input icAPMatchingLnPvodItem
    ()
input icAPMatchingLnPvodItemType
    ()
input icAPMatchingLnPvodLgCharge
    ()
input icAPMatchingLnPvodPrjCode
    ()
input idAPMatchingLnPvodReceiptQty
    ()
input icAPMatchingLnPvodSite
    ()
input idAPMatchingLnPvodUnitPrice
    ()
input idAPMatchingLnVarRateTC
    ()
input icPvoDomain
    ()
input icQADC01
    ()
input icQADC02
    ()
input icpod_loc
    ()
input iipod_op
    ()
input icpod_wo_Lot
    ()
input icprh_site
    ()
input icprh_type
    ()
input icprh_vend
    ()
input icpt_prod_line
    ()
input icpt_site
    ()
input icpvo_order_type
    ()
input icpvo_shipfrom
    ()
input icpvo_shipto
    ()
input icpvod_channel
    ()
input icpvod_shipto
    ()
input icvd_type
    ()
output ocGLCode
    ()
output ocDivisionCode
    ()
output ocCostCentreCode
    (CostCentreCode)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetGLPLVarRateNormal.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetGLPLVarRateNormal.after:

END PROCEDURE.
**/

/*
Procedure: GetJournalSequenceNumber
Description:
Parameters:
input icJournalCode
    ()
input iiYear
    ()
output oiVoucher
    ()
input icAPMatchingTcRowid
    (icAPMatchingTcRowid)
input icstatus
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetJournalSequenceNumber.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetJournalSequenceNumber.after:

END PROCEDURE.
**/

/*
Procedure: GetLogChargesPVOFromHeaderInfo
Description:
Parameters:
input icAPMatchingTcRowid
    ()
input icCurrencyCode
    ()
input iiCInvoiceVoucher
    ()
input idCInvoiceExchangeRate
    ()
input idCInvoiceRateScale
    ()
input ilCallGTM
    ()
input-output dataset tPendingVoucherAPM
    ()
input-output dataset tPendingVoucherTaxAPM
    ()
input-output dataset tPendingVoucherWHTAPM
    ()
input dataset tPendingVoucherHeader
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetLogChargesPVOFromHeaderInfo.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetLogChargesPVOFromHeaderInfo.after:

END PROCEDURE.
**/

/*
Procedure: GetOperationalMessage
Description:
This method provides translatable messages for operational updates.
Parameters:
input icMessageNumber
    ()
output ocMessage
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetOperationalMessage.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetOperationalMessage.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchers
Description:
This method can be used to retrieve pending vouchers which fits all filtering criteria. Method is usually executed from user interface
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
input icPendingVoucherType
    (Type of pending vocuher. See constants APMATCHINGPVOTYPE...)
input iiCInvoicePostingYear
    ()
input icCInvoiceJournalCode
    ()
input iiCInvoiceVoucher
    ()
input iiCInvoiceRegistrationNr
    (CInvoiceRegistrationNr)
input icCreditorCode
    ()
input ilIncludeEmptyCreditors
    ()
input icCurrencyCode
    ()
input idCInvoiceTCLCRate
    ()
input idCInvoiceTCLCScale
    ()
input idCInvoiceTCCCRate
    ()
input idCInvoiceTCCCScale
    ()
input idCInvoiceTotalAmountTC
    ()
input idCInvoiceARRecTaxTC
    ()
input idCInvoiceARNRecTaxTC
    ()
input itTransactionDateFrom
    ()
input itTransactionDateTill
    ()
input itTransactionDetailDateFrom
    ()
input itTransactionDetailDateTill
    ()
input icExternalReferenceFrom
    ()
input icExternalReferenceTo
    ()
input icInternalReferenceFrom
    ()
input icInternalReferenceTo
    ()
input icShipToFrom
    ()
input icShipToTo
    ()
input icItemNumberFrom
    ()
input icItemNumberTo
    ()
input icBuyer
    ()
input icApprovedBy
    ()
input icLogisticChargeFrom
    ()
input icLogisticChargeTo
    ()
input icShipFromFrom
    ()
input icShipFromTo
    ()
input ilAutoSelect
    ()
input icPOShipperInvoice
    ()
input icOrderFrom
    ()
input icOrderTo
    ()
input ilCallGTM
    (ilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher)
input dataset tOrderFilterAPM
    ()
output dataset tPendingVoucherAPM
    ()
output dataset tPendingVoucherTaxAPM
    ()
output dataset tPendingVoucherWHTAPM
    (temp-table that contains all wht records for the pending vouchers)
output dataset tPendingVoucherHeader
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchers.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchers.after:

END PROCEDURE.
**/

define new global shared variable xxx as int no-undo.

/*
PROCEDURE BAPMatching.GetPendingVouchers.after:

END PROCEDURE.
*/

/*
Procedure: GetPendingVouchersAssignCostMethodsCCRate
Description:
GetPendingVouchersAssignCostMethodsCCRate: submethod of GetPendingVouchers that is located in the same segment and that takes care of assigning the Cost-method related fields in tPendingVoucher and the assigning of the CCRate and CCScale
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersAssignCostMethodsCCRate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersAssignCostMethodsCCRate.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersAssignPendingMatchFields
Description:
GetPendingVouchersAssignPendingMatchFields: submethod of GetPendingVouchers that is located in the same segment and that takes care of assigning amount and qty of the pvod on other initial APMatchings
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersAssignPendingMatchFields.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersAssignPendingMatchFields.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersLogCharges
Description:
Submethod of GetPendingVouchers
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
input icCreditorCode
    ()
input ilIncludeEmptyCreditors
    ()
input icCurrencyCode
    ()
input idCInvoiceTCLCRate
    ()
input idCInvoiceTCLCScale
    ()
input idCInvoiceTCCCRate
    ()
input idCInvoiceTCCCScale
    ()
input idCInvoiceTotalAmountTC
    ()
input idCInvoiceARRecTaxTC
    ()
input idCInvoiceARNRecTaxTC
    ()
input itTransactionDateFrom
    ()
input itTransactionDateTill
    ()
input itTransactionDate
    ()
input itTransactionDetailDateFrom
    ()
input itTransactionDetailDateTill
    ()
input itTransactionDetailDate
    ()
input icExternalReferenceFrom
    ()
input icExternalReferenceTo
    ()
input icExternalReference
    ()
input icInternalReferenceFrom
    ()
input icInternalReferenceTo
    ()
input icInternalReference
    ()
input icShipToFrom
    ()
input icShipToTo
    ()
input icShipTo
    ()
input icItemNumberFrom
    ()
input icItemNumberTo
    ()
input icItemNumber
    ()
input icLogisticChargeFrom
    ()
input icLogisticChargeTo
    ()
input icLogisticCharge
    ()
input icShipFromFrom
    ()
input icShipFromTo
    ()
input icShipFrom
    ()
input ilAutoSelect
    ()
input icOrderFrom
    ()
input icOrderTo
    ()
input icOrder
    ()
input ilCallGTM
    (ilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher)
input iiApiPvoId
    ()
input iiApiPvodLineId
    (Pending voucher detail ID)
input idApiMatchAmtTC
    (Match amount of the logistic charge. This parameter is valid only , when PvoID and PvoLineID paramters are supplied. It means, this procedure processes only one pending voucher record.)
input ilApiIsPvodFinished
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogCharges.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogCharges.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersLogChargesQuery
Description:
Submethod of GetPendingVouchersLogCharges
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
input icCreditorCode
    ()
input ilIncludeEmptyCreditors
    ()
input icCurrencyCode
    ()
input idCInvoiceTCLCRate
    ()
input idCInvoiceTCLCScale
    ()
input idCInvoiceTCCCRate
    ()
input idCInvoiceTCCCScale
    ()
input idCInvoiceTotalAmountTC
    ()
input idCInvoiceARRecTaxTC
    ()
input idCInvoiceARNRecTaxTC
    ()
input itTransactionDateFrom
    ()
input itTransactionDateTill
    ()
input itTransactionDate
    ()
input itTransactionDetailDateFrom
    ()
input itTransactionDetailDateTill
    ()
input itTransactionDetailDate
    ()
input icExternalReferenceFrom
    ()
input icExternalReferenceTo
    ()
input icExternalReference
    ()
input icInternalReferenceFrom
    ()
input icInternalReferenceTo
    ()
input icInternalReference
    ()
input icShipToFrom
    ()
input icShipToTo
    ()
input icShipTo
    ()
input icItemNumberFrom
    ()
input icItemNumberTo
    ()
input icItemNumber
    ()
input icLogisticChargeFrom
    ()
input icLogisticChargeTo
    ()
input icLogisticCharge
    ()
input icShipFromFrom
    ()
input icShipFromTo
    ()
input icShipFrom
    ()
input ilAutoSelect
    ()
input icOrderFrom
    ()
input icOrderTo
    ()
input icOrder
    ()
input ilCallGTM
    (ilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher)
input iiApiPvoId
    ()
input iiApiPvodLineId
    (Pending voucher detail ID)
input idApiMatchAmtTC
    (Match amount of the logistic charge. This parameter is valid only , when PvoID and PvoLineID paramters are supplied. It means, this procedure processes only one pending voucher record.)
input ilApiIsPvodFinished
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesQuery.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesQuery.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersLogChargesTax
Description:
Submethod of GetPendingVouchersLogCharges
Parameters:
input ilCallGTM
    (Should we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesTax.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesTax.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersLogChargesTaxFiscal
Description:
Submethod of GetPendingVouchersLogCharges
Parameters:
input ilCallGTM
    (Should we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesTaxFiscal.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesTaxFiscal.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersLogChargesTaxWHT
Description:
Submethod of GetPendingVouchersLogChargesTax
Parameters:
input ilCallGTM
    (Should we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesTaxWHT.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersLogChargesTaxWHT.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersNoLogCharges
Description:
Submethod of GetPendingVouchers
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
input icCreditorCode
    ()
input idCInvoiceTCLCRate
    ()
input idCInvoiceTCLCScale
    ()
input idCInvoiceTCCCRate
    ()
input idCInvoiceTCCCScale
    ()
input icCurrencyCode
    ()
input idCInvoiceTotalAmountTC
    ()
input idCInvoiceARRecTaxTC
    ()
input idCInvoiceARNRecTaxTC
    ()
input itTransactionDateFrom
    ()
input itTransactionDateTill
    ()
input itTransactionDate
    ()
input itTransactionDetailDateFrom
    ()
input itTransactionDetailDateTill
    ()
input itTransactionDetailDate
    ()
input icExternalReferenceFrom
    ()
input icExternalReferenceTo
    ()
input icExternalReference
    ()
input icInternalReferenceFrom
    ()
input icInternalReferenceTo
    ()
input icInternalReference
    ()
input icShipToFrom
    ()
input icShipToTo
    ()
input icShipTo
    ()
input icItemNumberFrom
    ()
input icItemNumberTo
    ()
input icItemNumber
    ()
input icBuyer
    ()
input icApprovedBy
    ()
input icLogisticChargeFrom
    ()
input icLogisticChargeTo
    ()
input icLogisticCharge
    ()
input icShipFromFrom
    ()
input icShipFromTo
    ()
input icShipFrom
    ()
input ilAutoSelect
    ()
input icPOShipperInvoice
    ()
input icOrderList
    ()
input ilCallGTM
    (ilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher)
input iiApiPvodID
    (Pending voucher ID (in case of API integration))
input iiApiPvodLineId
    (Pending voucher line ID (in case of API integration))
input idApiMatchUnitPrice
    (Matched unit price (in case of API integration))
input idApiMatchQty
    (Match quantity (in case of API integration))
input ilApiIsPvodFinished
    (Is Pending voucher finished (in case of API integration))
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogCharges.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogCharges.after:

END PROCEDURE.
**/




/*
Procedure: GetPendingVouchersNoLogChargesQuery
Description:
Submethod of GetPendingVouchersNoLogCharges
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
input icCreditorCode
    ()
input idCInvoiceTCLCRate
    ()
input idCInvoiceTCLCScale
    ()
input idCInvoiceTCCCRate
    ()
input idCInvoiceTCCCScale
    ()
input icCurrencyCode
    ()
input idCInvoiceTotalAmountTC
    ()
input idCInvoiceARRecTaxTC
    ()
input idCInvoiceARNRecTaxTC
    ()
input itTransactionDateFrom
    ()
input itTransactionDateTill
    ()
input itTransactionDate
    ()
input itTransactionDetailDateFrom
    ()
input itTransactionDetailDateTill
    ()
input itTransactionDetailDate
    ()
input icExternalReferenceFrom
    ()
input icExternalReferenceTo
    ()
input icExternalReference
    ()
input icInternalReferenceFrom
    ()
input icInternalReferenceTo
    ()
input icInternalReference
    ()
input icShipToFrom
    ()
input icShipToTo
    ()
input icShipTo
    ()
input icItemNumberFrom
    ()
input icItemNumberTo
    ()
input icItemNumber
    ()
input icBuyer
    ()
input icApprovedBy
    ()
input icLogisticChargeFrom
    ()
input icLogisticChargeTo
    ()
input icLogisticCharge
    ()
input icShipFromFrom
    ()
input icShipFromTo
    ()
input icShipFrom
    ()
input ilAutoSelect
    ()
input icPOShipperInvoice
    ()
input icOrderList
    ()
input ilCallGTM
    (ilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher)
input iiApiPvodID
    (Pending voucher ID (in case of API integration))
input iiApiPvodLineId
    (Pending voucher line ID (in case of API integration))
input idApiMatchUnitPrice
    (ApiMatchUnitPrice
Matched unit price (in case of API integration))
input idApiMatchQty
    (ApiMatchQty
Match quantity (in case of API integration))
input ilApiIsPvodFinished
    (ApiIsPvodFinished
Is Pending voucher finished (in case of API integration))
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesQuery.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesQuery.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersNoLogChargesTax
Description:
Submethod of GetPendingVouchersNoLogCharges
Parameters:
input ilAutoSelect
    (Auto-select)
input ilCallGTM
    (Shoudl we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTax.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTax.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersNoLogChargesTaxFiscal
Description:
Submethod of GetPendingVouchersNoLogCharges
Parameters:
input ilAutoSelect
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTaxFiscal.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTaxFiscal.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersNoLogChargesTaxFiscalWHT
Description:
Submethod of GetPendingVouchersNoLogChargesTax
Parameters:
input ilAutoSelect
    (Auto-select)
input ilCallGTM
    (Shoudl we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTaxFiscalWHT.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTaxFiscalWHT.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersNoLogChargesTaxWHT
Description:
Submethod of GetPendingVouchersNoLogChargesTax
Parameters:
input ilAutoSelect
    (Auto-select)
input ilCallGTM
    (Shoudl we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTaxWHT.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersNoLogChargesTaxWHT.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersPOShipper
Description:
Get pending vouchers which are related to purchase order shipper invoice.
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
input icPOShipperInvoice
    ()
input icSupplier
    ()
input ilAutoSelect
    ()
input idCInvoiceTCLCRate
    ()
input idCInvoiceTCLCScale
    ()
input idCInvoiceTCCCRate
    ()
input idCInvoiceTCCCScale
    ()
input idCInvoiceTotalAmountTC
    ()
input idCInvoiceARRecTaxTC
    ()
input idCInvoiceARNRecTaxTC
    ()
input ilCallGTM
    (ilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersPOShipper.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersPOShipper.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersPOShipperTax
Description:
Submethod of GetPendingVouchersPOShipper
Parameters:
input ilAutoSelect
    (AutoSelect)
input ilCallGTM
    (Should we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersPOShipperTax.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersPOShipperTax.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersPOShipperTaxWHT
Description:
Submethod of GetPendingVouchersPOShipperTax
Parameters:
input ilAutoSelect
    (AutoSelect)
input ilCallGTM
    (Should we call GTM)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersPOShipperTaxWHT.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersPOShipperTaxWHT.after:

END PROCEDURE.
**/

/*
Procedure: GetPendingVouchersValidate
Description:
This method is used to normalize and validate input parameers  for retrieving of pending vouchers
Parameters:
input icAPMatchingTcRowid
    (Rowid (converted to character) of the matching. This corresponds with field tAPMatching.tc_rowid.)
input icPendingVoucherType
    ()
input iiCInvoicePostingYear
    ()
input icCInvoiceJournalCode
    ()
input iiCInvoiceVoucher
    ()
input iiCInvoiceRegistrationNr
    (CInvoiceRegistrationNr)
input-output bcCreditorCode
    ()
input-output bcCurrencyCode
    ()
input-output bdCInvoiceTCLCRate
    ()
input-output bdCInvoiceTCLCScale
    ()
input-output bdCInvoiceTCCCRate
    ()
input-output bdCInvoiceTCCCScale
    ()
input-output btTransactionDateFrom
    ()
input-output btTransactionDateTill
    ()
input-output btTransactionDetailDateFrom
    ()
input-output btTransactionDetailDateTill
    ()
input-output bcExternalReferenceFrom
    ()
input-output bcExternalReferenceTo
    ()
input-output bcInternalReferenceFrom
    ()
input-output bcInternalReferenceTo
    ()
input-output bcShipToFrom
    ()
input-output bcShipToTo
    ()
input-output bcItemNumberFrom
    ()
input-output bcItemNumberTo
    ()
input-output bcBuyer
    ()
input-output bcApprovedBy
    ()
input-output bcLogisticChargeFrom
    ()
input-output bcLogisticChargeTo
    ()
input-output bcShipFromFrom
    ()
input-output bcShipFromTo
    ()
input-output blAutoSelect
    ()
input-output bcPOShipperInvoice
    ()
input-output bcOrderFrom
    ()
input-output bcOrderTo
    ()
input-output blCallGTM
    (ilCallGTM: Set to true in case you want this method to call GTM to recalculate the taxes. If false, then the taxes will just be taken from the pending-voucher)
output ocExternalReference
    ()
output ocInternalReference
    ()
output ocShipFrom
    ()
output ocShipTo
    ()
output ocItemNumber
    ()
output ocLogisticCharge
    ()
output otTransactionDate
    ()
output otTransactionDetailDate
    ()
output ocOrder
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPendingVouchersValidate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPendingVouchersValidate.after:

END PROCEDURE.
**/

/*
Procedure: LoadMatchingPosting
Description:
This method reads matching posting if available
Parameters:
input iiPostingId
    ()
output oiInstanceJournalEntryId
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.LoadMatchingPosting.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.LoadMatchingPosting.after:

END PROCEDURE.
**/

/*
Procedure: PostSaveUpdateOperationals
Description:
Perform update of operational data related to save of receiver matching
Parameters:
input dataset tInitialAPMatching
    (dataset of t_iAPMatching)
input dataset tInitialAPMatchingLn
    (t_iAPMatchingLn)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.PostSaveUpdateOperationals.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.PostSaveUpdateOperationals.after:

END PROCEDURE.
**/

/*
Procedure: ReplaceAPMatching
Description:
This method creates receiver matching lines according based on the original receiver matching for the Supplier Invoice
Parameters:
input iiOriginalAPMId
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ReplaceAPMatching.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ReplaceAPMatching.after:

END PROCEDURE.
**/

/*
Procedure: SetPublicTablesForTT
Description:
SetPublicTablesForTT: variant of the generated method SetPublicTables that has got an input of temp-tables in stead of a dataset that is linked to the t_s<tables>
Parameters:
input ilValidate
    (Should the input data be validated or not?
If this is not the case, then the input-data will just be transfered to the business-side and not Validations or AdditionalUpdates will be executed.)
input dataset tSPTAPMatching
    (tSPTAPMatching: temp-table used as input for methods SetPublicTablesForTT and SetPublicTablesDataSaveForTT)
input dataset tSPTAPMatchingLn
    (tSPTAPMatchingLn: temp-table used as input for methods SetPublicTablesForTT and SetPublicTablesDataSaveForTT)
input dataset tSPTAPMatchingLnTax
    (tSPTAPMatchingLnTax: temp-table used as input for methods SetPublicTablesForTT and SetPublicTablesDataSaveForTT)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.SetPublicTablesForTT.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetPublicTablesForTT.after:

END PROCEDURE.
**/

/*
Procedure: UpdateCInvoiceFromAPMClassTables
Description:
UpdateCInvoiceFromAPMClassTables: this public, non-api method can be called from other classes and it will update the total amount of the invoice and the tax-details of the invoice
Parameters:
input icAPMatchingTcRowid
    (icAPMatchingTcRowid: TcRowid of the APMatching record.
If this param has a value then param iiAPMatchingID will be ignored)
input iiAPMatchingID
    (iiAPMatching: ID of the Matching: 
In case icAPMatchingTcRowid is filled then this parameter will not be used)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.UpdateCInvoiceFromAPMClassTables.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UpdateCInvoiceFromAPMClassTables.after:

END PROCEDURE.
**/

/*
Procedure: UpdateCInvoiceFromUIAPM
Description:
UpdateCInvoiceFromAPM: this method can be called from the UI and it will update the total amount of the invoice and the tax-details of the invoice
Parameters:
input iiAPMatchingID
    (ID of the Matching)
input iiCInvoiceID
    (ID of the invoice that is being matched)
input iiPostingID
    (PostingID: ID of the posting (optional))
input dataset tSPTAPMatchingLn
    (Temp-table holding the Lines of the matching)
input dataset tSPTAPMatchingLnTax
    (Temp-table holding the Taxes of the Lines of the matching)
input dataset tSPTAPMatchingLnWHT
    (Temp-table holding the WHT of the Lines of the matching)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.UpdateCInvoiceFromUIAPM.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UpdateCInvoiceFromUIAPM.after:

END PROCEDURE.
**/

/*
Procedure: UpdateMatchingLinesAndSubFromUI
Description:
Parameters:
input ictAPMAtchingTcRowid
    (icAPMatchingTcRowid: TcRowid of the APMatching record.)
input-output dataset tSPTAPMatchingLn
    (Temp-table holding the Lines of the matching)
input-output dataset tSPTAPMatchingLnTax
    (Temp-table holding the Taxes of the Lines of the matching)
input-output dataset tSPTAPMatchingLnWHT
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.UpdateMatchingLinesAndSubFromUI.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UpdateMatchingLinesAndSubFromUI.after:

END PROCEDURE.
**/

/*
Procedure: ValCInvoice
Description:
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
input icYearJournalVoucher
    (Year + / + Journal + / + Voucher)
input icCInvoiceType
    ()
input ilCInvoiceIsLogisticMatching
    ()
input icCInvoiceAllocationStatus
    ()
input ilCInvoiceIsInvoiceApproved
    ()
input iiCInvoiceCompanyID
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValCInvoice.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValCInvoice.after:

END PROCEDURE.
**/

/*
Procedure: ValidateBCAndAdditionalUpdates
Description:
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateBCAndAdditionalUpdates.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateBCAndAdditionalUpdates.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPost
Description:
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPost.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPost.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPostAPM1
Description:
Parameters:
input-output blStartPeriodByStartEndDateStat
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM1.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM1.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPostAPM2
Description:
Parameters:
input-output blStartAPMatchingByCInvoiceID
    ()
input-output blStartCInvoiceForAPMSelection
    (Started query CInvoiceForSelection)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM2.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM2.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPostAPM3PLI
Description:
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM3PLI.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM3PLI.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPostAPM4LogCharge
Description:
ValidateComponentPostAPM4LogCharge: Submethod of ValidateComponentPostAPM that performs some validations for the logis-charges
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM4LogCharge.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPM4LogCharge.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPostAPMLn1
Description:
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPMLn1.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPMLn1.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPostAPMLn2
Description:
Parameters:
input-output blStartAPMatchingLnByStatusPvod
    (StartAPMatchingLnByStatusPvod)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPMLn2.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPostAPMLn2.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPre
Description:
ValidateComponentPreValidate: submethod of ValidateComponent
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPre.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPre.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPreAPM
Description:
ValidateComponentPreValidateAPM: submethod of ValidateComponentPreValidate
Parameters:
input-output blQueryStartedCInvoiceForSelect
    (QueryStartedCInvoiceForSelect)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPM.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPM.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPreAPMCInvoice
Description:
This method updates Supplier invoice about total matched amount and about all tax details - values are taken from one receiver matching.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMCInvoice.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMCInvoice.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPreAPMCInvoiceLegalDocument
Description:
This procedure validates that the invoice amount and legal document amounts are the same.
Parameters:
input-output bdTotalInvoiceAmountLC
    ()
input-output bdTotalInvoiceAmountTC
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMCInvoiceLegalDocument.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMCInvoiceLegalDocument.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPreAPMLn1
Description:
ValidateComponentPreValidateAPMLn1: submethod of ValidateComponentPreValidate
Parameters:
input-output blQueryStartedPLInvoiceDetail
    ()
input-output blBCostingOpenedForCostMethod
    (blBCostingStartedForCostMethod)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMLn1.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMLn1.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPreAPMLn2
Description:
ValidateComponentPreValidateAPMLn2: submethod of ValidateComponentPreValidate
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMLn2.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMLn2.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPreAPMLnTax
Description:
ValidateComponentPreValidateAPMLnTax: submethod of ValidateComponentPreValidate that will create the the underlaying tax-records when needed
Parameters:
output odSumARRecTaxTC
    (SumARRecTaxTC)
output odSumARNRecTaxTC
    (SumARNRecTaxTC)
output odSumAIRecTaxTC
    (SumAIRecTaxTC)
output odSumAINRecTaxTC
    (SumAINRecTaxTC)
output odSumOrigARRetainTaxTC
    (SumAROrigRetainTaxTC)
output odSumOrigARRecTaxTC
    (SumOrigARRecTaxTC)
output odSumOrigARNRecTaxTC
    (SumOrigARNRecTaxTC)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMLnTax.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPreAPMLnTax.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponentPreTaxAbsRet
Description:
ValidateComponentPreValidate: submethod of ValidateComponent
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateComponentPreTaxAbsRet.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponentPreTaxAbsRet.after:

END PROCEDURE.
**/

/*
Procedure: ValJournal
Description:
ValJournal
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
input icJournalTypeCode
    ()
input ilJournalIsActive
    ()
input iiJournalLayerID
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValJournal.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValJournal.after:

END PROCEDURE.
**/

/*
Procedure: ValPeriod
Description:
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
input icPeriodStatus
    ()
input ilPeriodIsPostingGLAllowed
    ()
input ilPeriodIsPostingPurchAllow
    (Period.PeriodIsPostingPurchAllow)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValPeriod.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValPeriod.after:

END PROCEDURE.
**/

/*
Procedure: ValReason
Description:
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
input ilReasonIsActive
    ()
input icReasonAllocationStatus
    ()
input ilReasonIsLogisticMatching
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValReason.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValReason.after:

END PROCEDURE.
**/

/*
Procedure: IsOperationalReplicationEnabled
Description:
Retrieves the session value which indicates whether replication from financials to logistics is enabled
Parameters:
output olReplicationEnabled
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.IsOperationalReplicationEnabled.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.IsOperationalReplicationEnabled.after:

END PROCEDURE.
**/

/*
Procedure: MappedBufferCopy
Description:
Performs a buffer copy from a source buffer to a target buffer using the specified field mappings to copy the data.
Parameters:
input ihSourceBuffer
    (Handle to the source buffer from which the data is going to be copied.)
input ihTargetBuffer
    (Handle to the target buffer to which the data is going to be copied.)
input icBufferFieldMapping
    (Comma delimited list of the field mappings between the buffers. It does not matter if the list is in <target-buffer-field>,<source-buffer-field> order or vice versa progress will automatically switch the fields depending on is the target and source buffers.)
input icExcludeFields
    (Contains a comma delimited list of the fields that should not be copied by the from the source to the target.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.MappedBufferCopy.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.MappedBufferCopy.after:

END PROCEDURE.
**/

/*
Procedure: ValCharNotNULL
Description:
ValCharNotNULL: Validation-method that raises an error in case the character-field has the NULL value
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValCharNotNULL.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValCharNotNULL.after:

END PROCEDURE.
**/

/*
Procedure: ValDateNotNULL
Description:
ValDateNotNULL: Validation-method that raises an error in case the date-field has the NULL value
Parameters:
input itTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValDateNotNULL.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValDateNotNULL.after:

END PROCEDURE.
**/

/*
Procedure: ValIntNotNULL
Description:
ValIntNotNULL: Validation-method that raises an error in case the integer-field has the NULL value
Parameters:
input iiTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValIntNotNULL.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValIntNotNULL.after:

END PROCEDURE.
**/

/*
Procedure: AddDetailLine
Description:
Create a record in one of the class temp-tables.
Parameters:
input icTable
    (Database table name)
input icParentRowid
    (contents for field tc_ParentRowid (tc_Rowid of the parent record))
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.AddDetailLine.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddDetailLine.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalUpdates
Description:
This method is part of the SetPublicTables flow.
When executed, data in the input class tables (prefix t_s) is validated and found correct, and copied into the class tables (prefix t_o).
This method can be extended to do updates that do not require a validation or that involve running business methods of other business classes. These classes should be started with ADD-TO-TRANSACTION = 'true'. Also make sure to add these classes in method StopExternalInstances.
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.AdditionalUpdates.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalUpdates.after:

END PROCEDURE.
**/

/*
Procedure: apiDeleteInstance
Description:
Generic procedure for deleting database objects. This procedure contains the entire flow of loading the object data, validating if it can be deleted, deleting and deleting all related objects (= cascading deletes).
Parameters:
input icKey
    (Database instance key.
possible values:
'Rowid=...'
'Primary=...'
'Identity=...')
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.apiDeleteInstance.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.apiDeleteInstance.after:

END PROCEDURE.
**/

/*
Procedure: ApiDumpXmlRepresentation
Description:
Write an XML file with the object data of one or more database objects.
This XML file uses the standard schema found in <server installation folder>/xml/<class>.xsd.
It can be used as input for method ApiMaintainByXML and for the XML daemon.
Parameters:
input icRowids
    (Comma separated list of rowids of objects to include in the XML file)
input icFile
    (Full path name of the file in which the XML should be dumped.)
input ilHeaderOnly
    (When true, only the main table will be included in the generated XML representation.)
input ilSuppressEmptyFields
    (When true, blank fields will be removed from the XML Representation. Blank means empty string, or unknown value for all other data types. Zero is not considered an empty value.
When false, no fields will be removed.
When unknown value, fields with value identical to the default value of that column will be removed. If actual value is the unknown value, and the default value is not unknown value, this unknown value will not be removed.)
input iiPriority
    (If Priority is different from 0, an additional tag (Priority) will be added in the header of the XML object.)
input ilWriteXMLSchema
    (When true, also include the metaschema in the XML file.)
input icObjectRowId
    (If you want to restrict dumped data to a single object, pass the rowid of the object.
Otherwise leave blanc, and all objects identified by icRowids will be dumped.)
input ilExportForInput
    (When exporting an XML file to be used for direct input, some fields should be suppressed in the output:
tContextInfo.tcInvolvedCompanyCodes
tContextInfo.tcCorrelationId
tContextInfo.tcObjectIdentifier
all '*_ID' fields
all 'tc_Status' fields
(BLF-1908))
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiDumpXmlRepresentation.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiDumpXmlRepresentation.after:

END PROCEDURE.
**/

/*
Procedure: ApiDumpXmlRepresentationV01
Description:
Write an XML file with the object data of one or more database objects.
This XML file uses the standard schema found in <server installation folder>/xml/<class>.xsd.
It can be used as input for method ApiMaintainByXML and for the XML daemon.
Parameters:
input ipRowids
    (Comma separated list of rowids of objects to include in the XML file)
input icFile
    (Full path name of the file in which the XML should be dumped.)
input ilHeaderOnly
    (When true, only the main table will be included in the generated XML representation.)
input ilSuppressEmptyFields
    (When true, blank fields will be removed from the XML Representation. Blank means empty string, or unknown value for all other data types. Zero is not considered an empty value.
When false, no fields will be removed.
When unknown value, fields with value identical to the default value of that column will be removed. If actual value is the unknown value, and the default value is not unknown value, this unknown value will not be removed.)
input iiPriority
    (If Priority is different from 0, an additional tag (Priority) will be added in the header of the XML object.)
input ilWriteXMLSchema
    (When true, also include the metaschema in the XML file.)
input icObjectRowId
    (If you want to restrict dumped data to a single object, pass the rowid of the object.
Otherwise leave blanc, and all objects identified by icRowids will be dumped.)
input ilExportForInput
    (When exporting an XML file to be used for direct input, some fields should be suppressed in the output:
tContextInfo.tcInvolvedCompanyCodes
tContextInfo.tcCorrelationId
tContextInfo.tcObjectIdentifier
all '*_ID' fields
all 'tc_Status' fields
(BLF-1908))
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiDumpXmlRepresentationV01.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiDumpXmlRepresentationV01.after:

END PROCEDURE.
**/

/*
Procedure: ApiForcePublish
Description:
Parameters:
input dataset tObject
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiForcePublish.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiForcePublish.after:

END PROCEDURE.
**/

/*
Procedure: ApiGetIdentification
Description:
This method gives the possibility to get identification information (primary key, alternate key, rowid, object ID, object status) of the main table of the object, based on any of the keys of the table.
NOTE: for some business components, a few functions must be implemented manually :
- loading data starting from the alternate key
- defining the alternate key field names + values, starting from any of the other keys
(This is when the alternate key cannot be defined unambiguously by CB.)
Parameters:
input-output bcPrimaryKey
    (The primary key value of the main table of the object.
In case of a combined primary key, the different values should be separated with chr(2))
input-output bcAlternateKey
    (The alternate key value of the main table of the object.
In case of a combined alternate key, the different values should be separated with chr(2))
input-output bcRowid
    (The rowid of the main table record of the object.)
input-output biObjectId
    (Identity field of the main table of the object.)
output ocObjectStatusValues
    (chr(2) seperated list of value of object status fields)
output ocObjectStatusFieldNames
    (Comma seperated list of field name of object status fields)
output ocPrimaryKeyFieldNames
    (List of primary key fields of the main table of the object.
This is a comma separated list.)
output ocAlternateKeyFieldNames
    (List of alternate key fields (names) of the main table of the object.
This is a comma separated list.)
output ocAlternateKeyFieldLabels
    (List of alternate key fields (translated labels) of the main table of the object.
This is a chr(2) separated list.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiGetIdentification.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiGetIdentification.after:

END PROCEDURE.
**/

/*
Procedure: ApiGetRoleScopeValues
Description:
Roles can be scoped to a single object (like for example a single project).
Run this method on the corresponding business component (= bproject) to get a list of possible objects (= projects) to scope a role to.
Parameters:
input iiCompanyID
    (current CompanyID)
input iiSharedSetID
    (current SharedSetID)
input icBusComponentConcept
    (BusComponentConcept of the business-component)
output ocRoleScopeValues
    (chr(2) separated list with the RoleScopeValues)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiGetRoleScopeValues.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiGetRoleScopeValues.after:

END PROCEDURE.
**/

/*
Procedure: apiMaintainByXml
Description:
Generic method for creating or updating object data.
This method provides the same functionality as the XML daemon.
Parameters:
input imDocument
    (contents of the XML document (or use parameter icFileName))
input icFileName
    (file name of the xml document (or use parameter imDocument))
output olSuccess
    (update completed successfully)
output dataset tXmlObjects
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.apiMaintainByXml.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.apiMaintainByXml.after:

END PROCEDURE.
**/

/*
Procedure: ApiReplicate
Description:
This is a generic procedure for updating database objects. This procedure is capable of handling multiple objects in one run, but cannot save draft instances if the input data is incorrect, like procedure ApiMaintainByDataset can.
Parameters:
input dataset-handle izInputData by-reference
    (class dataset)
input icActivityCode
    (Activity code (CREATE or MODIFY or DELETE) determines the kind of update. Value of tc_Status in the input data is ignored.
When empty, CREATE or UPDATE is assumed, depending on whether the input data already exists in the application database.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiReplicate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiReplicate.after:

END PROCEDURE.
**/

/*
Procedure: BufferCopy
Description:
This method can be used to copy data from one temp-table to another.  It takes care about the normal fields, but also the temp-table fields (with prefix t<datatype>).
It copies all fields from the current record in the temp-table represented by ihFrom, to the current record in the temp-table represented by ihTo.
Parameters:
input ihFrom
    (The handle to the temp-table from which you want to copy the content.)
input ihTo
    (Handle to the temp-table to which you want to copy the content.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.BufferCopy.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.BufferCopy.after:

END PROCEDURE.
**/

/*
Procedure: Calculate
Description:
Add code here to initialize the calculated fields of the class temp-tables after loading existing records from the application database.
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.Calculate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.Calculate.after:

END PROCEDURE.
**/

/*
Procedure: CheckValidationExceptionList
Description:
Evaluate updates in the class temp-tables.
If updates other than to fields listed in vcValidationExceptionList are found return true, otherwise return false.
Parameters:
input ilValidateInputData
    (When true, evaluate the input data (= tables with prefix t_s).
When false, evaluate the business data (= tables with prefix t_o).)
output olDoValidation
    ()
*/
/**
PROCEDURE BAPMatching.CheckValidationExceptionList.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CheckValidationExceptionList.after:

END PROCEDURE.
**/

/*
Procedure: ClearData
Description:
Remove contents of all class temp-tables.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ClearData.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ClearData.after:

END PROCEDURE.
**/

/*
Procedure: ConvertXmlToTable
Description:
read xml node and write to class temp-tables (t_s***)
Parameters:
input ihParentNode
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ConvertXmlToTable.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ConvertXmlToTable.after:

END PROCEDURE.
**/

/*
Procedure: CorrectionForPartialUpdate
Description:
Correct the data in the S buffer for a partial update

first, take care about the buffers with tc_status = "D".  If their rowid is not in the list of vcForceDeleteRowids, then they should be marked as tc_status = "" 

then, make sure to copy the O buffer value of fields that are in vcNeglectableFields to the S buffer
Parameters:
input icPartialUpdateExceptionList
    (Comma separated list with fields that need to be skipped in the test logic for partial update.
Fields in the list are specified as t<table>.<field>.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.CorrectionForPartialUpdate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CorrectionForPartialUpdate.after:

END PROCEDURE.
**/

/*
Procedure: DataDelete
Description:
Validate if current database instance(s) present in the class temp-tables can be deleted in the application database. If so, set status to 'D'. Records will be removed from the database on commit of the transaction.
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.DataDelete.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataDelete.after:

END PROCEDURE.
**/

/*
Procedure: DataDescription
Description:
Returns a table with metadata on all tables in the class dataset.
Useful for writing generic code that reads or updates these tables.
Parameters:
input icRowids
    ()
input icPkey
    ()
input icObjectIds
    ()
input ilAllTables
    (true = return all class tables
false = return only database tables)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DataDescription.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataDescription.after:

END PROCEDURE.
**/

/*
Procedure: DataLoad
Description:
Load data from the database into the class temp-tables of the business class.
Records can be selected based on primary keys (full or partly), rowids or identity values.
Parameters:
input icRowids
    (Comma seperated list of rowids of records of the main table, converted to string format.)
input icPkeys
    (List of the values of the primary key fields of records of the main table.
Fields are chr(2) seperated, keys are chr(4) seperated.
Fields are listed in the order as they appear in the primary index. You are not obliged to give a value for all fields of the primary index, but the list cannot contain any 'gaps'.)
input icObjectIds
    (Comma seperated list of values of the identity field of records of the main table.)
input icFreeform
    (In case none of the standard keys (primary, rowid, identity) are available, you can load data based on a freeform for each statement on the main table of the business class.
This for each statement should not contain break by, sorting or no-lock options.)
input ilKeepPrevious
    (True if the data to load must be added to the already existing data in the class temp-tables.
False if the data to load must replace the already existing data.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.DataLoad.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataLoad.after:

END PROCEDURE.
**/

/*
Procedure: DataLoadByInput
Description:
This method loads database records corresponding to input values (records found in the t_s*** tables).
When nothing found in the database, a new record should be initialised.
Input values should also be updated with :
- identity fields (override input values)
- tc_Rowid / tc_ParentRowid / tc_Status
Parameters:
output opPrimeKey
    (Primary Key field value of loaded record(s).
Keys are chr(4) separated.
Key fields are chr(2) separated.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DataLoadByInput.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataLoadByInput.after:

END PROCEDURE.
**/

/*
Procedure: DataNew
Description:
Create a new database instance in the class temp-tables. Existing contents of the class temp-tables will be discarded.
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.DataNew.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataNew.after:

END PROCEDURE.
**/

/*
Procedure: DataSave
Description:
Write the data of current instance to the database.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DataSave.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataSave.after:

END PROCEDURE.
**/

/*
Procedure: DataSaveWorker
Description:
A sub part of the transaction process.
This function must be public, so it can be called from the transaction component, but should not be used directly by the developer.
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.DataSaveWorker.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataSaveWorker.after:

END PROCEDURE.
**/

/*
Procedure: DumpXmlRemoveFieldsNotForInput
Description:
remove fields from the xml that are irrelevant to direct input
Parameters:
input ihTableNode
    (x-noderef object)
*/
/**
PROCEDURE BAPMatching.DumpXmlRemoveFieldsNotForInput.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DumpXmlRemoveFieldsNotForInput.after:

END PROCEDURE.
**/

/*
Procedure: DumpXmlRepresentation
Description:
Write an XML file with the object data of the database object(s) currently in memory.
This XML file uses the standard schema found in <server installation folder>/xml/<class>.xsd.
It can be used as input for method ApiMaintainByXML and for the XML daemon.
Parameters:
input icFile
    (Full path name of the file in which the XML should be dumped.)
input ilHeaderOnly
    (indicates whether only the main table should be used in the generated XML representation.)
input ilSuppressEmptyFields
    (When true, blank fields will be removed from the XML Representation. Blank means empty string, or unknown value for all other data types. Zero is not considered an empty value.
When false, no fields will be removed.
When unknown value, fields with value identical to the default value of that column will be removed. If actual value is the unknown value, and the default value is not unknown value, this unknown value will not be removed.)
input iiPriority
    (If Priority is different from 0, an additional tag (Priority) will be supported in the header of the Xml string.)
input ilWriteXMLSchema
    (Also include the metaschema in the XML file)
input icObjectRowId
    (If you want to restrict dumped data to a single object, pass the rowid of the object.
Otherwise leave blanc, and all objects in memory will be dumped.)
input ilExportForInput
    (When exporting an XML file to be used for direct input, some fields should be suppressed in the output:
tContextInfo.tcInvolvedCompanyCodes
tContextInfo.tcCorrelationId
tContextInfo.tcObjectIdentifier
all '*_ID' fields
all 'tc_Status' fields
(BLF-1908))
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DumpXmlRepresentation.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DumpXmlRepresentation.after:

END PROCEDURE.
**/

/*
Procedure: DumpXmlToLongchar
Description:
Write an XML representation of the database object(s) currently in memory to a longchar.
This XML representation uses the standard schema found in <server installation folder>/xml/<class>.xsd.
Parameters:
input ilHeaderOnly
    (indicates whether only the main table should be used in the generated XML representation.)
input ilSuppressEmptyFields
    (When true, blank fields will be removed from the XML Representation. Blank means empty string, or unknown value for all other data types. Zero is not considered an empty value.
When false, no fields will be removed.
When unknown value, fields with value identical to the default value of that column will be removed. If actual value is the unknown value, and the default value is not unknown value, this unknown value will not be removed.)
input iiPriority
    (If Priority is different from 0, an additional tag (Priority) will be supported in the header of the Xml string.)
input ilWriteXMLSchema
    (Also include the metaschema in the XML file)
input icObjectRowId
    (If you want to restrict dumped data to a single object, pass the rowid of the object.
Otherwise leave blanc, and all objects in memory will be dumped.)
input ilExportForInput
    (When exporting an XML file to be used for direct input, some fields should be suppressed in the output:
tContextInfo.tcInvolvedCompanyCodes
tContextInfo.tcCorrelationId
tContextInfo.tcObjectIdentifier
all '*_ID' fields
all 'tc_Status' fields
(BLF-1908))
output opXmlRepresentation
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DumpXmlToLongchar.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DumpXmlToLongchar.after:

END PROCEDURE.
**/

/*
Procedure: EventPublishing
Description:
Wrapper for method PublishEvent, loop through all database objects in memory.
Parameters:
input ilForcePublish
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.EventPublishing.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.EventPublishing.after:

END PROCEDURE.
**/

/*
Procedure: EventPublishingLookForUpdates
Description:
look for a record in the class tables with updates (tc_Status not empty)
Parameters:
input icParentTable
    ()
input icParentRowid
    ()
input-output bcQueryNames
    ()
input-output bcQueryHandles
    ()
output olUpdateFound
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.EventPublishingLookForUpdates.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.EventPublishingLookForUpdates.after:

END PROCEDURE.
**/

/*
Procedure: GetActivities
Description:
Return a list of defined activity codes that can be performed by current user on any object of current class. Activities that cannot be run from the appshell (activity sequence = 0) are not included.
Parameters:
output dataset tActivities
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetActivities.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetActivities.after:

END PROCEDURE.
**/

/*
Procedure: GetActivitiesForObject
Description:
Return a list of defined activity codes that can be performed by current user on a specific object of current class. Activities that cannot be run from the appshell (activity sequence = 0) are not included.
Parameters:
input iiObjectId
    (identity value)
input icUserLogin
    (User that will perform the activity
(Optional : when both icUserLogin and iiRoleId are empty, current user (from Session.Login) will be used))
input iiRoleId
    (Role that will perform the activity
(Optional : when both icUserName and iiRoleId are empty, current user (from Session.Login) will be used))
output dataset tActivities
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetActivitiesForObject.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetActivitiesForObject.after:

END PROCEDURE.
**/

/*
Procedure: GetActivitiesForStatus
Description:
Returns a list of activities allowed on current object in the class temp-tables, based on the status of the object.
Blanc =  all activities allowed.
Parameters:
input iiObjectId
    (Object ID)
output ocActivityCodes
    ()
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.GetActivitiesForStatus.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetActivitiesForStatus.after:

END PROCEDURE.
**/

/*
Procedure: GetBusinessFieldsGenCode
Description:
Parameters:
input icGenCode
    ()
output ocValueList
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetBusinessFieldsGenCode.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetBusinessFieldsGenCode.after:

END PROCEDURE.
**/

/*
Procedure: GetCustomFieldList
Description:
Returns a list of available custom fields
Parameters:
output ocFieldList
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetCustomFieldList.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetCustomFieldList.after:

END PROCEDURE.
**/

/*
Procedure: GetPKValues
Description:
Get the value of primary key fields of current record in a class temp-table.
Parameters:
input ihBuffer
    (handle to class temp-table buffer)
output ocPKValue
    (chr(2) seperated list of field values)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPKValues.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPKValues.after:

END PROCEDURE.
**/

/*
Procedure: GetXmlRepresentationDataset
Description:
Get a dataset with the object data of the database object(s) currently in memory.
This dataset uses the standard schema found in <server installation folder>/xml/<class>.xsd.
Parameters:
input icObjectRowId
    (If you want to restrict dumped data to a single object, pass the rowid of the object.
Otherwise leave blanc, and all objects in memory will be dumped.)
input ilHeaderOnly
    (indicates whether only the main table should be used in the generated XML representation.)
input iiPriority
    (If Priority is different from 0, an additional tag (Priority) will be supported in the header of the Xml string.)
output dataset-handle ozXMLDataset by-reference
    (This parameter should always be passed by-reference, meaning, the dataset handle should be created before the call.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetXmlRepresentationDataset.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetXmlRepresentationDataset.after:

END PROCEDURE.
**/

/*
Procedure: GetXmlRepresentationDSAddTable
Description:
Parameters:
input icTableName
    ()
input ictcRowid
    ()
input ictcParentRowid
    ()
input ilHeaderOnly
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetXmlRepresentationDSAddTable.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetXmlRepresentationDSAddTable.after:

END PROCEDURE.
**/

/*
Procedure: HandleSuppressEmptyFields
Description:
Method that is called recursively to handle the suppress emtpy fields option of DumpXmlRepresentation.
Parameters:
input ihParent
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.HandleSuppressEmptyFields.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.HandleSuppressEmptyFields.after:

END PROCEDURE.
**/

/*
Procedure: InitialValues
Description:
Add code here to initialize the calculated fields of a 'new' record (= a record that must be created in the application database) in a class temp-table.
Parameters:
input icTableName
    (Name of the database table of which a record is created in the class temp-table.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.InitialValues.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.InitialValues.after:

END PROCEDURE.
**/

/*
Procedure: MaintainByDataset
Description:
This method uses contents of the input class temp-tables (prefix t_s) to perform the action specified in icAction.
SAVE : validate contents and write to database if correct
SAVEDRAFT : validate contents, write to database if correct, copy the data to the class tables (prefix t_o) and create draft instance if incorrect
DRAFT : copy data to the class tables (prefix t_o) and create draft instance
VALIDATE : only validate data
Parameters:
input icAction
    (SAVE
SAVEDRAFT
DRAFT
VALIDATE)
output opPrimaryKey
    ()
output opRowid
    ()
output oiDraftInstance
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.MaintainByDataset.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.MaintainByDataset.after:

END PROCEDURE.
**/

/*
Procedure: MaintainByDatasetDefaulting
Description:
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.MaintainByDatasetDefaulting.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.MaintainByDatasetDefaulting.after:

END PROCEDURE.
**/

/*
Procedure: MaintainByDatasetWithOutput
Description:
This method uses contents of the input class temp-tables (prefix t_s) to perform the action specified in icAction. (if icAction is empty, it gets the default value of "SAVE")
SAVE : validate contents and write to database if correct
SAVEDRAFT : validate contents, write to database if correct, copy the data to the class tables (prefix t_o) and create draft instance if incorrect
DRAFT : copy data to the class tables (prefix t_o) and create draft instance
VALIDATE : only validate data

It returns the object dataset if required (if ilProvideOutput = true).
Parameters:
input icAction
    (SAVE
SAVEDRAFT
DRAFT
VALIDATE)
input ilReturnDataset
    (Indication whether the logic should return the official dataset of the object that has just been created/modified.)
input ilPartialUpdate
    (Indication whether the input dataset is a full object or only a partial one.)
input icPartialUpdateExceptionList
    (Comma separated list with fields that need to be skipped in the test logic for partial update.
Fields in the list are specified as t<table>.<field>.)
output opPrimaryKey
    ()
output opRowid
    ()
output oiDraftInstance
    ()
output ocPrimaryKeyName
    (The name of the field(s) in the primary key of the object.  Normally this is the name of the object ID of the main table. (like creditor_ID))
output dataset-handle ozObjectRepresentation by-reference
    (The dataset containing the official representation of the object dataset. It should always be passed by-reference, meaning, the dataset handle should be created before the call.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.MaintainByDatasetWithOutput.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.MaintainByDatasetWithOutput.after:

END PROCEDURE.
**/

/*
Procedure: ObjectStatusUpdate
Description:
This procedure contains code to be executed when the database object changes status.
This includes object creation.
This does not include object delete.
Parameters:
input icStatusFieldName
    ()
input icOldStatus
    (old status)
input icNewStatus
    (new status)
input iiObjectId
    (identity field value)
input icObjectRowid
    (tc_Rowid of main table)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ObjectStatusUpdate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ObjectStatusUpdate.after:

END PROCEDURE.
**/

/*
Procedure: PartialSetSTables
Description:
Method to set a dataset in the t_s temp-tables, based on a dataset-handle as input.
This is a variation of the SetSTables method, in the sense that it accepts a dataset as input that has an incomplete structure.  Some fields might be missing from the dataset that is sent in.
If fields are missing from the input, the value in the t_s buffer will be the unknown value (?).  It is the intention that in the rest of the flow of processing the data, these fields are treated separately, to make sure the original value of the changed record is not overwritten with the unknown value.
Parameters:
input dataset-handle izDatasetHandle by-reference
    (The input parameter holding a handle to the dataset with the input values. This must always be a subset of the official object dataset.  It might have missing fields.)
input ilIsPartialUpdate
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.PartialSetSTables.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.PartialSetSTables.after:

END PROCEDURE.
**/

/*
Procedure: PopulateXDocument
Description:
Populate the passed document handle with an XML representation of the database object(s) currently in memory.
This XML representation uses the standard schema found in <server installation folder>/xml/<class>.xsd.
Parameters:
input icObjectRowId
    (If you want to restrict dumped data to a single object, pass the rowid of the object.
Otherwise leave blank, and all objects in memory will be dumped.)
input ilHeaderOnly
    (indicates whether only the main table should be used in the generated XML representation.)
input ilSuppressEmptyFields
    (When true, blank fields will be removed from the XML Representation. Blank means empty string, or unknown value for all other data types. Zero is not considered an empty value.
When false, no fields will be removed.
When unknown value, fields with value identical to the default value of that column will be removed. If actual value is the unknown value, and the default value is not unknown value, this unknown value will not be removed.)
input iiPriority
    (If Priority is different from 0, an additional tag (Priority) will be supported in the header of the Xml string.)
input ilWriteXMLSchema
    (Also include the metaschema in the XML file)
input ilExportForInput
    (When exporting an XML file to be used for direct input, some fields should be suppressed in the output:
tContextInfo.tcInvolvedCompanyCodes
tContextInfo.tcCorrelationId
tContextInfo.tcObjectIdentifier
all '*_ID' fields
all 'tc_Status' fields
(BLF-1908))
input ihDocument
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.PopulateXDocument.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.PopulateXDocument.after:

END PROCEDURE.
**/

/*
Procedure: PostSave
Description:
Actions to take after writing current instance to the database, and before final commit of the transaction.
Use the field tc_status to test the status of the updated records:
'' = unchanged
'N' = new
'C' = changed
'D' = deleted
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.PostSave.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.PostSave.after:

END PROCEDURE.
**/

/*
Procedure: PostTransaction
Description:
Actions to take after final commit of the transaction.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.PostTransaction.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.PostTransaction.after:

END PROCEDURE.
**/

/*
Procedure: PreSave
Description:
Actions to take before writing current instance to the database (inside the db transaction!).
Use the field tc_status to test the status of the updated records:
'' = unchanged
'N' = new
'C' = changed
'D' = deleted
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.PreSave.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.PreSave.after:

END PROCEDURE.
**/

/*
Procedure: PublishEvent
Description:
Check if any event publishing is active for current class and publish (= create a request for the event daemon) the update if there is.
Parameters:
input ilAllChanges
    ()
input icStatusFieldName
    ()
input icOldStatus
    ()
input icNewStatus
    ()
input iiObjectID
    ()
input icObjectRowid
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.PublishEvent.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.PublishEvent.after:

END PROCEDURE.
**/

/*
Procedure: ReadObjectSecurity
Description:
Returns object security on currently loaded (with DataLoad) object
Parameters:
output dataset tSelectedActivities
    ()
output dataset tSelectedUsers
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ReadObjectSecurity.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ReadObjectSecurity.after:

END PROCEDURE.
**/

/*
Procedure: ReadTable
Description:
Read field values of a specific record in one of the class temp-tables.
(Used from referential integrity)
Parameters:
input icTableName
    (class temp-table name)
input icQuery
    (read statement)
input icFieldNames
    (Comma seperated list of table field names)
input ilConvertToDisplayFormat
    (Only relevant for decimal or date fields)
output ocFieldValues
    (chr(3) seperated list of the field values (if a record is found))
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ReadTable.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ReadTable.after:

END PROCEDURE.
**/

/*
Procedure: SetNewStatus
Description:
Change the status of all current class temp-table records to 'N'.
Useful for making a copy of a database instance.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.SetNewStatus.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetNewStatus.after:

END PROCEDURE.
**/

/*
Procedure: SetRowidConvert
Description:
Creates or updates a tFcRowidConvert record to link client rowids to instance rowids.
Parameters:
input icOldRowid
    ()
input icNewRowid
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.SetRowidConvert.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetRowidConvert.after:

END PROCEDURE.
**/

/*
Procedure: StopExternalInstances
Description:
Stop instances that are started in AdditionalUpdates as part of current transaction
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.StopExternalInstances.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.StopExternalInstances.after:

END PROCEDURE.
**/

/*
Procedure: UndoStatus
Description:
Remove all records from tFcRowidConvert created during last transaction, because this transaction was rolled back.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.UndoStatus.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UndoStatus.after:

END PROCEDURE.
**/

/*
Procedure: UpdateLastModified
Description:
update LastModified*** fields
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.UpdateLastModified.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UpdateLastModified.after:

END PROCEDURE.
**/

/*
Procedure: UpdateStatus
Description:
Reset field tc_Status of the class temp-tables to blanc, after the transaction is completed.
Replace dummy rowid's in field tc_Rowid and tc_ParentRowid with the real ones.
(wrapper for the generated method)
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.UpdateStatus.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UpdateStatus.after:

END PROCEDURE.
**/

/*
Procedure: UpdateWorkobject
Description:
When updating a database object that is registered in workflow, lookup the corresponding work object and update the status of it (either return the work object to sender or delete it).
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.UpdateWorkobject.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UpdateWorkobject.after:

END PROCEDURE.
**/

/*
Procedure: ValCharForbiddenCharCodes
Description:
Validation mask to check if a certain field contains any characters commonly used as field separator, like pipe(|) or comma(,), and return an error if it does.
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValCharForbiddenCharCodes.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValCharForbiddenCharCodes.after:

END PROCEDURE.
**/

/*
Procedure: ValCharMandatory
Description:
Validation mask: character field cannot be empty.
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a class temp-table.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ValCharMandatory.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValCharMandatory.after:

END PROCEDURE.
**/

/*
Procedure: ValDateMandatory
Description:
Validation mask: date field cannot be empty.
Parameters:
input itTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a class temp-table.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ValDateMandatory.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValDateMandatory.after:

END PROCEDURE.
**/

/*
Procedure: ValDecMandatory
Description:
Validation mask: decimal field cannot be empty (= unknown value).
Parameters:
input idTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a class temp-table.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ValDecMandatory.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValDecMandatory.after:

END PROCEDURE.
**/

/*
Procedure: ValDecNotZero
Description:
Validation mask: decimal field cannot be zero.
Parameters:
input idTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a class temp-table.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ValDecNotZero.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValDecNotZero.after:

END PROCEDURE.
**/

/*
Procedure: ValidateActivityCode
Description:
check if current user has permission to perform current activity on current object(s)
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateActivityCode.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateActivityCode.after:

END PROCEDURE.
**/

/*
Procedure: ValidateBC
Description:
Validate the class temp-tables, when values are created / modified in the business class.
Because all validations are written on the t_s*** tables, and business code maintains it's data in the t_o*** tables, data from the t_o*** tables is first copied into the t_s*** tables, and copied back after the validation (in case the validation updated some fields).
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateBC.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateBC.after:

END PROCEDURE.
**/

/*
Procedure: ValidateComponent
Description:
Write here all tests on database update (new / modify / delete) that cannot be coded with a validation mask.
The type of update can be found in tc_status (N/C/D).
If you find incorrect data, you must write an entry in tFcMessages (using SetMessage) and set the return status of this method to either +1 or -1.
Return status +1 = data will still be accepted.
Return status -1 = data will not be accepted.
This method is run from SetPublicTables, before transferring the received data into the class temp-tables.
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ValidateComponent.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateComponent.after:

END PROCEDURE.
**/

/*
Procedure: ValidateCustomFields
Description:
Check if values on active custom fields meet the validation criteria in the definition of the custom field and return an error if they don't.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateCustomFields.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateCustomFields.after:

END PROCEDURE.
**/

/*
Procedure: ValidateCustomFieldsGenCode
Description:
Parameters:
input icGenCode
    ()
input icFieldName
    ()
input icFieldValue
    ()
input icRowid
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateCustomFieldsGenCode.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateCustomFieldsGenCode.after:

END PROCEDURE.
**/

/*
Procedure: ValidateFieldSecurity
Description:
This method validates the field security on the business side. It verifies that business fields that may not be modified are not modified.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateFieldSecurity.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateFieldSecurity.after:

END PROCEDURE.
**/

/*
Procedure: ValidateUI
Description:
Validate the class temp-tables, when values are created / modified by a user interface class, and sent to the business class as input parameter of a public method, other than SetPublicTables.
When data in the t_s*** tables is correct, it is copied into the t_o***tables.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValidateUI.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValidateUI.after:

END PROCEDURE.
**/

/*
Procedure: ValIntMandatory
Description:
Validation mask: integer cannot be empty (= unknown value).
Parameters:
input iiTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a class temp-table.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ValIntMandatory.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValIntMandatory.after:

END PROCEDURE.
**/

/*
Procedure: ValIntNotZero
Description:
Validation mask: integer field cannot be zero.
Parameters:
input iiTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a class temp-table.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ValIntNotZero.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValIntNotZero.after:

END PROCEDURE.
**/

/*
Procedure: ValIsActive
Description:
On relations to a table with an 'IsActive' field, use this validation mask to check the field and return an error if an object that is not active is referenced.
Parameters:
input icTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a component temp-table.)
input ilIsActive
    (Active flag)
input icParentObjectLabel
    (parent object)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValIsActive.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValIsActive.after:

END PROCEDURE.
**/

/*
Procedure: ValLogMandatory
Description:
Validation mask: logical field cannot be empty.
Parameters:
input ilTargetField
    (Value of the business field to validate.)
input icTargetFieldName
    (Name of the business field to validate.)
input icRowid
    (Contents of field tc_Rowid, if the target field is a field of a class temp-table.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ValLogMandatory.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValLogMandatory.after:

END PROCEDURE.
**/

/*
Procedure: ValueChanged
Description:
Check if a business field has changed value.
Parameters:
input icFieldName
    ()
output olChanged
    ()
*/
/**
PROCEDURE BAPMatching.ValueChanged.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ValueChanged.after:

END PROCEDURE.
**/

/*
Procedure: WriteObjectSecurity
Description:
Create or update object security for the database object available in the class dataset.
Parameters:
input dataset tSelectedActivities
    ()
input dataset tSelectedUsers
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.WriteObjectSecurity.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.WriteObjectSecurity.after:

END PROCEDURE.
**/

/*
Procedure: XmlColumnDetail
Description:
This method is called from within the generic code to create an XML representation of a component instance.  It is called for each column in the component that is represented in the XML document.
In this method, one can add method calls to other components for sub-representations.  For example: customer information on an order object.

/**  EXAMPLE CODE
assign oiReturnStatus = -98.

case icTableName :
    when "order":U
    then case icColumnName :
            when "custnum":U
            then do :
                if not available torder or
                   rowid(tOrder) <> ihBuffer:rowid
                then buffer tOrder:find-by-rowid(ihBuffer:rowid) no-error.
                if available tOrder
                then do :
                run XMLrepresentation (input  torder.custnum (icKey), 
                                input  'customer.name':U (icColumns), 
                                input  ihCurrentNode (ihStartingNode), 
                                output viFcReturnSuper (oiReturnStatus)) in bOrder
                end.
            end.
         end case.
end case.
assign oiReturnStatus = viFcReturnSuper.
**/
Parameters:
input icTableName
    (Name of the (class) table to which the column belongs.)
input icColumnName
    (Name of the concerning column)
input ihBuffer
    (Handle to the table buffer)
input ihField
    ()
input ihParentNode
    (Handle to the current XML node.)
input ilSuppressEmptyFields
    (if true, the empty fields will be dropped out of the xml representation.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.XmlColumnDetail.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.XmlColumnDetail.after:

END PROCEDURE.
**/

/*
Procedure: XmlObjectDetail
Description:
This method is called from within the generic code to create an XML representation of a component instance.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.XmlObjectDetail.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.XmlObjectDetail.after:

END PROCEDURE.
**/

/*
Procedure: XmlTableDetail
Description:
This method is called from within the generic code to create an XML representation of a component instance.  It is called for each table in the component that is represented in the XML document.
In this method, one can add method calls to other components for sub-representations.  For example: customer information on an order object.
Parameters:
input icTableName
    (Database table name)
input ihBuffer
    (handle to temp-table buffer (with current record available))
input ihParentNode
    (node handle in the XML document)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.XmlTableDetail.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.XmlTableDetail.after:

END PROCEDURE.
**/

/*
Procedure: GetComment
Description:
Parameters:
input icDomain
    ()
input icRef
    ()
input icType
    ()
input icLang
    ()
input iiIndx
    ()
input iiSeq
    ()
output opComment
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetComment.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetComment.after:

END PROCEDURE.
**/

/*
Procedure: GetExchangeRate
Description:
GetExchangeRate: this method will provide you the correct exchange-rate based upon the input parameters you provide.
Parameters:
input iiCompanyID
    (CompanyID: the company wherefor you want to retrieve the exchange-rate - when empty then the current company is used)
input iiFromCurrencyID
    (FromCurrencyID: when this is not specified and the associated Code-parameter is not filled either, then an error is raised)
input icFromCurrencyCode
    (FromCurrencyCode: this is only used and required in case the associated ID-parameter is not filled)
input iiToCurrencyID
    (ToCurrency ID: when this is not specified and the associated Code-parameter is not filled either, then the local-/base-currency is used as the ToCurrency)
input icToCurrencyCode
    (ToCurrencyCode: this is only used in case the associated ID-parameter is not filled)
input iiExchangeRateTypeID
    (ExchangeRateType ID: when this is not specified and the associated Code-parameter is not filled either, then the rate-type will be set to Accounting)
input icExchangeRateTypeCode
    (ExchangeRateType Code: this is only used in case the associated ID-parameter is not filled)
input itValidityDate
    (ValidityDate: Date you want to know the exchange-rate for. If nothing is passed then the sytem-date is used as validaty-date)
output odExchangeRate
    (Exchange Rate (always Multiply) of the retrieved rate.

Sample: 
When you have 120 EUR and you want to know how many HRK this is then you call this method like this :
 -  From-curr:  EUR 
 - To-curr:  KRK
Then odExchangeRate will be 8 as 1 EUR = 8 HRK (and odExchangeScale will be 1).

So the value in HRK of 120 EUR will be: 
120 * 8 * 1
(AmountInFromCurr) * odExchangeRate * odExchangeScale)
output odExchangeScaleFactor
    (Exchange Rate Scale Factor of the retrieved rate)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetExchangeRate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetExchangeRate.after:

END PROCEDURE.
**/

/*
Procedure: AddAdditionalInfoInCTLOG
Description:
This procedure is just meant to log extra information in ctlog to allow a better troubleshooting.
Parameters:
input icTrace
    ()
input icParam1
    ()
input icParam2
    ()
input icParam3
    ()
input icParam4
    ()
input icParam5
    ()
input icParam6
    ()
input icParam7
    ()
input icParam8
    ()
input icParam9
    ()
*/
/**
PROCEDURE BAPMatching.AddAdditionalInfoInCTLOG.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AddAdditionalInfoInCTLOG.after:

END PROCEDURE.
**/

/*
Procedure: AdditionalDocumentation
Description:
This procedure only cotains comments which are important for the class.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.AdditionalDocumentation.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.AdditionalDocumentation.after:

END PROCEDURE.
**/

/*
Procedure: ApiActivitiesAreAllowed
Description:
check if a user has security rights for a list of activities
Parameters:
input icUserLogin
    ()
input icCompanyCode
    ()
input icActivityCodes
    (comma separated list)
output ocAllowed
    (comma separated list of true or false according to the input activity codes)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiActivitiesAreAllowed.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiActivitiesAreAllowed.after:

END PROCEDURE.
**/

/*
Procedure: apiActivityIsAllowed
Description:
check if user has security rights for an activity
Parameters:
input icUsrLogin
    (login name)
input icCompanyCode
    (Entity Code)
input icActivityCode
    (Activity Code)
output olIsAllowed
    (has access)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.apiActivityIsAllowed.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.apiActivityIsAllowed.after:

END PROCEDURE.
**/

/*
Procedure: ApiGetAlternateKeyValues
Description:
This procedure can be used to convert filtering conditions (on browses or reports) on primary key fields into filtering conditions on alternate key fields, which are more readable. This procedure will for example convert a language ID (which is a meaningless number) into a language code. Conversion rules are generated based on the definition of related key business fields in the business class.
Parameters:
input dataset tFilter
    (input dataset with filter conditions)
output dataset tBusinessFieldValues
    (output dataset with converted displayable filter conditions)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiGetAlternateKeyValues.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiGetAlternateKeyValues.after:

END PROCEDURE.
**/

/*
Procedure: ApiQueryFilterPrepare
Description:
This method contains generic code for parsing the input filter criteria for API queries in table tFilter.
Parameters:
input icTables
    (tables in the query)
input-output dataset tFilter
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ApiQueryFilterPrepare.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ApiQueryFilterPrepare.after:

END PROCEDURE.
**/

/*
Procedure: BusinessClassActions
Description:
Provide all necessary functions to start and stop instances of a business class, both for stateless and for state-reset environments.
Parameters:
input icClassShortname
    (Shortname of the business class)
input icAction
    (Possible actions:
Start                        Close
Open                       Stop
Start+Open             Close+Stop
                               Store)
input ilSubtransaction
    (Start the new business instance as part of current transaction yes/no.)
input-output biClassOpenCount
    (use vi{&CLASS}OC)
input-output bhClassInstanceHandle
    (use vh{&CLASS}Inst)
input-output biClassInstanceId
    (use vi{&CLASS}Id)
input icDraftReference
    (A description for the stored instance)
input icUserDefinedContext
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.BusinessClassActions.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.BusinessClassActions.after:

END PROCEDURE.
**/

/*
Procedure: ClearMessages
Description:
Clear the message list (tFcMessages).
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ClearMessages.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ClearMessages.after:

END PROCEDURE.
**/

/*
Procedure: CustomFields
Description:
Returns the name of all active custom business fields in the class dataset.
Parameters:
input icTableName
    (Database table name)
output ocFieldNames
    (comma seperated list of field names)
output ocFieldLabels
    (chr(2) seperated list of user-defined labels for custom business fields, translated to current-language)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.CustomFields.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CustomFields.after:

END PROCEDURE.
**/

/*
Procedure: DefineCustomRelations
Description:
This method is foreseen in the abstract component, and is available on all business components and should be used to define information about relations to custom tables in the component.  This method is always empty in case of a non-customized component.  The method should be implemented using non-intrusive customization in order to get the relations known to the UI side.
Typically, this method contains code as follows:

create tCustomRelation.
assign tCustomRelation.tcParentTable = "tCurrency"
       tCustomRelation.tcChildTable = "tCustomTable1"
       tCustomRelation.tcChildTableDescription = "Variantion"
       tCustomRelation.tlIsOneToOne = false.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DefineCustomRelations.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DefineCustomRelations.after:

END PROCEDURE.
**/

/*
Procedure: DefineState
Description:
Allows to add tables to the state dataset
(ihStateDataset:add-buffer(...))
Parameters:
input ihStateDataset
    ()
*/
/**
PROCEDURE BAPMatching.DefineState.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DefineState.after:

END PROCEDURE.
**/

/*
Procedure: DumpInstanceData
Description:
dump all current instance data into an XML file
Parameters:
input icXMLFileName
    (full path file name to write the instance data to
(when blanc, no file will be created))
input icXSDFileName
    (full path file name to write the XML schema of the instance data to
(when blanc, no file will be created))
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.DumpInstanceData.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DumpInstanceData.after:

END PROCEDURE.
**/

/*
Procedure: ExitInstance
Description:
This method can be extended with code to execute when an instance of a business class is stopped.

Standard functionality in this method is
- Clean up instance data in the fcInstance table.
- Create or update a draft instance if applicable.
Parameters:
input icDraftReference
    (Description for the draft instance.
This parameter will have a value when creating a draft instance.)
input icDraftFormName
    (This parameter will have a value when creating a draft instance.)
input ilDraftIsShared
    (This parameter will have a value when creating a draft instance.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ExitInstance.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ExitInstance.after:

END PROCEDURE.
**/

/*
Procedure: ExitProgram
Description:
This method can be extended with code to execute when a business component is stopped.
Parameters:
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.ExitProgram.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ExitProgram.after:

END PROCEDURE.
**/

/*
Procedure: GetBusinessFields
Description:
Returns a full description of all business fields of a business class, browse or report.
Parameters:
input icReference
    (- <classname> for receiving business field information of a business class
- <classname>.<methodname> for receiving business field information of a browse or report)
output dataset tBusinessFields
    ()
output dataset tCustomRelation
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetBusinessFields.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetBusinessFields.after:

END PROCEDURE.
**/

/*
Procedure: GetCustomFieldValues
Description:
fill in a column of a temp-table with custom fields from a business object main table
Parameters:
input ihResultSetBuffer
    ((buffer) handle to the temp-table that must be updated)
input icClass
    (shortname of the business class from which custom fields must be read)
input icTable
    (database table name from which custom fields must be read)
input icKeyColumn
    (name of the column in the result set temp-table that contains the value of primary key of the objects for which custom fields must be read)
input icCustomFieldColumn
    (name of the column in the result set temp-table where custom field values will be stored)
input icCustomBusinessField
    (The can be left blank.
You can specify here the name of the custom busininess fields if you want the value of just 1 of them.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetCustomFieldValues.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetCustomFieldValues.after:

END PROCEDURE.
**/

/*
Procedure: GetDomainFormat
Description:
This method allows to overrule the standard display format of a domain.
Parameters:
input icDomainName
    ()
output ocDisplayFormat
    (display format, using the progress syntax)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetDomainFormat.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetDomainFormat.after:

END PROCEDURE.
**/

/*
Procedure: GetKeyFields
Description:
Returns the name of all key fields of a table in the class dataset.

primary key = all fields of the primary index of the table
alternate key = all fields of an index that is an 'alternate key'
(If a table has exactly one unique index other than the primary index, and all fields in that index are business fields, this index automatically becomes the alternate key. Otherwise an index must be marked as alternate key manually.)
object ID = one field of the table that is an 'identity' field
object status = one or more fields of the table that is a 'status' field
Parameters:
input-output bcTableName
    (Database table name.
When left blanc, the name of the main table of the class dataset will be returned.)
output ocPrimaryKey
    (comma seperated list of database field names (excluding table name))
output ocAlternateKey
    (comma seperated list of database field names (excluding table name)
these fields MUST be defined as business field)
output ocObjectID
    (database field name (excluding table name) of the identity field)
output ocObjectStatus
    (database field name (excluding table name) of the status field)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetKeyFields.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetKeyFields.after:

END PROCEDURE.
**/

/*
Procedure: GetLocalisationCode
Description:
Returns current active localisation code.
Parameters:
output ocLocalisationCode
    ()
*/
/**
PROCEDURE BAPMatching.GetLocalisationCode.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetLocalisationCode.after:

END PROCEDURE.
**/

/*
Procedure: GetPublicData
Description:
Procedure for reading the value of public data items, except temp-tables and datasets.
Parameters:
input icDataList
    (Comma seperated list of public data item names to set (full name, including prefix).
Data items with extent and temp-tables are not supported.)
output ocValues
    (chr(3) seperated list of the values.
Format of the values:
decimal = always uses decimal point
date = YYYYMMDD
logical = true / false)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.GetPublicData.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPublicData.after:

END PROCEDURE.
**/

/*
Procedure: InitInstance
Description:
This method can be extended with code to execute when an instance of a business class is started.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.InitInstance.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.InitInstance.after:

END PROCEDURE.
**/

/*
Procedure: LoadSystemSettings
Description:
Load system settings (see class BSetting) and store them in variables available to all business classes.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.LoadSystemSettings.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.LoadSystemSettings.after:

END PROCEDURE.
**/

/*
Procedure: LoadUIstate
Description:
load UI state
Parameters:
output omState
    (State data)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.LoadUIstate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.LoadUIstate.after:

END PROCEDURE.
**/

/*
Procedure: MainBlock
Description:
This method can be extended with code to execute when a business component is started.
Use it to initialise data items that are not part of the business component state.
(Data items that are part of the business component state should be initialised in InitInstance.)
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.MainBlock.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.MainBlock.after:

END PROCEDURE.
**/

/*
Procedure: ReadSessionValues
Description:
Read some comonly used values from session like current user login or current company ID and store these values in variables available to all business classes.
Parameters:
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.ReadSessionValues.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.ReadSessionValues.after:

END PROCEDURE.
**/

/*
Procedure: SaveUIstate
Description:
save UI state
Parameters:
input imState
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.SaveUIstate.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SaveUIstate.after:

END PROCEDURE.
**/

/*
Procedure: SetMessage
Description:
Create a message to send back to the client (either a UI or another application)
Parameters:
input icMessage
    (The actual message, can contain $1, $2, ... for values that are situation-dependent.)
input icArguments
    (chr(2) seperated list of values to replace $1, $2, ... in the message with. These values should not be translatable.)
input icFieldName
    (Optional name of a business field, to link the message to that field.)
input icFieldValue
    (Optional value of the business field, converted to string type.)
input icType
    (Type of message:
E = user error (incorrect input, this type of error is linked to a business field)
D = database error (other errors)
S = system error (or programming error)
W = warning, results in return status +1 (the transaction can still proceed))
input iiSeverity
    (Error severity level (used to sort the messages on in the error viewer):
1 = critical
2 = high
3 = normal
4 = low)
input icRowid
    (Optional rowid to link the message to a single record in the class temp-table (mentioned in parameter icFieldName).
Refers to the field tc_Rowid.)
input icFcMsgNumber
    (A unique number per CB project.
DO NOT CHANGE THIS PARAMETER)
input icFcExplanation
    (Long description, fully explaining what exactly caused the error or warning, and what has to be done to solve the error/warning involved.)
input icFcIdentification
    (If the error is linked to a specific business object, this field should fully identify this object.
The content of this field is considered to be untranslatable.)
input icFcContext
    (Change the description of the icContext parameter of the SetMessage method.

Here, the developer can pass extra context information to the end-user that can help him to understand why things went wrong. 

This field contains context information, like booleans, data items, result of buffer-compare. 
We advise to use the syntax "<Field>=<Value>chr(2)<Field>=<Value>...." as this is recognized by the error viewer. 
The content of this field is considered to be untranslatable.)
output oiReturnStatus
    ()
*/
/**
PROCEDURE BAPMatching.SetMessage.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetMessage.after:

END PROCEDURE.
**/

/*
Procedure: SetPublicData
Description:
Procedure for updating the value of public data items, except temp-tables and datasets.
Parameters:
input icDataList
    (Comma seperated list of public data item names to set (full name, including prefix).
Data items with extent and temp-tables are not supported.)
input icValueList
    (chr(3) seperated list of the values to set.
Format of the values:
decimal = use decimal point, replace comma with a point
date = YYYYMMDD
logical = true / false)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.SetPublicData.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetPublicData.after:

END PROCEDURE.
**/

/*
Procedure: StartCacher
Description:
Start the cacher technical component, if not yet running.
The component will be run only once and will be kept into memory until the server shuts down (stateless) or the user disconnects (state-reset).
Parameters:
output ohCacher
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.StartCacher.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.StartCacher.after:

END PROCEDURE.
**/

/*
Procedure: StartPersistence
Description:
Start the persistence component, if not yet running.
The component will be run only once and will be kept into memory until the server shuts down (stateless) or the user disconnects (state-reset).
Parameters:
output ohPersistence
    (Handle to the correct persistence component.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.StartPersistence.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.StartPersistence.after:

END PROCEDURE.
**/

/*
Procedure: StoreState
Description:
Store current instance as a draft instance in the application database (fcDraftInstance table)
Parameters:
input icDescription
    (Description for the draft instance.)
input icUIClass
    (Shortname of the user interface class used to open the draft instance with.)
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.StoreState.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.StoreState.after:

END PROCEDURE.
**/

/*
Procedure: UICustomization
Description:
Parameters:
input icControlName
    ()
input icEventName
    ()
input dataset tUIInput
    ()
output dataset tUIOutput
    ()
output oiReturnStatus
    (Return status of the method.)
*/
/**
PROCEDURE BAPMatching.UICustomization.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.UICustomization.after:

END PROCEDURE.
**/


/*BBX20150806 ----- Upgrade End   -------  */
/*
Procedure: GetPublictFcMessages
Description:
read table
Parameters:
output dataset tFcMessages
    (Contains a list of messages to display on the client side. Records in the table should not be created directly, but by using method SetMessage.)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.GetPublictFcMessages.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPublictFcMessages.after:

END PROCEDURE.
**/

/*
Procedure: SetPublictFcMessages
Description:
write table
Parameters:
input dataset tFcMessages
    (Contains a list of messages to display on the client side. Records in the table should not be created directly, but by using method SetMessage.)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.SetPublictFcMessages.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetPublictFcMessages.after:

END PROCEDURE.
**/

/*
Procedure: GetPublicTables
Description:
read class tables
Parameters:
output dataset BAPMatchingO
    (class tables)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.GetPublicTables.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.GetPublicTables.after:

END PROCEDURE.
**/

/*
Procedure: DataNewGetPublicTables
Description:
combine DataNew and GetPublicTables
Parameters:
output dataset BAPMatchingO
output oiReturnStatus
*/
/**
PROCEDURE BAPMatching.DataNewGetPublicTables.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataNewGetPublicTables.after:

END PROCEDURE.
**/

/*
Procedure: DataLoadGetPublicTables
Description:
combine DataLoad and GetPublicTables
Parameters:
input icRowids
input icPkeys
input icObjectIds
input icFreeform
input ilKeepPrevious
output dataset BAPMatchingO
output oiReturnStatus
*/
/**
PROCEDURE BAPMatching.DataLoadGetPublicTables.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.DataLoadGetPublicTables.after:

END PROCEDURE.
**/

/*
Procedure: SetPublicTables
Description:
write class tables
Parameters:
input il_Validate
    (validate data in class tables and reject if invalid
     when il_Validate = false, data can only be saved as a draft)
input dataset BAPMatchingS
    (class tables)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.SetPublicTables.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetPublicTables.after:

END PROCEDURE.
**/

/*
Procedure: SetPublicTablesDataSave
Description:
combine SetPublicTables and DataSave
Parameters:
input dataset BAPMatchingS
    (class tables)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.SetPublicTablesDataSave.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.SetPublicTablesDataSave.after:

END PROCEDURE.
**/

/*
Procedure: CreateAPMatching
Description:
add a record in a class table
Parameters:
input ic_ParentRowid
    (value of tc_Rowid field of parent row)
output dataset BAPMatchingS
    (class tables, containing only the newly created row)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.CreateAPMatching.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CreateAPMatching.after:

END PROCEDURE.
**/

/*
Procedure: CreateAPMatchingLn
Description:
add a record in a class table
Parameters:
input ic_ParentRowid
    (value of tc_Rowid field of parent row)
output dataset BAPMatchingS
    (class tables, containing only the newly created row)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.CreateAPMatchingLn.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CreateAPMatchingLn.after:

END PROCEDURE.
**/

/*
Procedure: CreateAPMatchingLnRevTax
Description:
add a record in a class table
Parameters:
input ic_ParentRowid
    (value of tc_Rowid field of parent row)
output dataset BAPMatchingS
    (class tables, containing only the newly created row)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.CreateAPMatchingLnRevTax.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CreateAPMatchingLnRevTax.after:

END PROCEDURE.
**/

/*
Procedure: CreateAPMatchingLnTax
Description:
add a record in a class table
Parameters:
input ic_ParentRowid
    (value of tc_Rowid field of parent row)
output dataset BAPMatchingS
    (class tables, containing only the newly created row)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.CreateAPMatchingLnTax.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CreateAPMatchingLnTax.after:

END PROCEDURE.
**/

/*
Procedure: CreateAPMatchingLnWHT
Description:
add a record in a class table
Parameters:
input ic_ParentRowid
    (value of tc_Rowid field of parent row)
output dataset BAPMatchingS
    (class tables, containing only the newly created row)
output oiReturnStatus
    (error number)
*/
/**
PROCEDURE BAPMatching.CreateAPMatchingLnWHT.before:

END PROCEDURE.
**/
/**
PROCEDURE BAPMatching.CreateAPMatchingLnWHT.after:

END PROCEDURE.
**/

